mirror of
				https://github.com/owncloud/android-library.git
				synced 2025-10-31 02:17:41 +00:00 
			
		
		
		
	Set modification date from the file in filesystem to the file to upload
This commit is contained in:
		
							parent
							
								
									0fef17a609
								
							
						
					
					
						commit
						274e0ec47b
					
				| @ -52,14 +52,14 @@ public class ChunkedUploadRemoteFileOperation extends UploadRemoteFileOperation | |||||||
|     private static final String OC_CHUNK_X_OC_MTIME_HEADER = "X-OC-Mtime"; |     private static final String OC_CHUNK_X_OC_MTIME_HEADER = "X-OC-Mtime"; | ||||||
|     private static final String TAG = ChunkedUploadRemoteFileOperation.class.getSimpleName(); |     private static final String TAG = ChunkedUploadRemoteFileOperation.class.getSimpleName(); | ||||||
| 
 | 
 | ||||||
|     public ChunkedUploadRemoteFileOperation(String storagePath, String remotePath, String mimeType){ |     public ChunkedUploadRemoteFileOperation(String storagePath, String remotePath, String mimeType, String fileLastModifTimestamp){ | ||||||
|         super(storagePath, remotePath, mimeType); |         super(storagePath, remotePath, mimeType, fileLastModifTimestamp); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public ChunkedUploadRemoteFileOperation( |     public ChunkedUploadRemoteFileOperation( | ||||||
|             String storagePath, String remotePath, String mimeType, String requiredEtag |             String storagePath, String remotePath, String mimeType, String requiredEtag, String fileLastModifTimestamp | ||||||
|     ){ |     ){ | ||||||
| 		 super(storagePath, remotePath, mimeType, requiredEtag); | 		 super(storagePath, remotePath, mimeType, requiredEtag, fileLastModifTimestamp); | ||||||
| 	} | 	} | ||||||
|      |      | ||||||
|     @Override |     @Override | ||||||
| @ -101,10 +101,7 @@ public class ChunkedUploadRemoteFileOperation extends UploadRemoteFileOperation | |||||||
|                 mPutMethod.addRequestHeader(OC_CHUNK_SIZE_HEADER, chunkSizeStr); |                 mPutMethod.addRequestHeader(OC_CHUNK_SIZE_HEADER, chunkSizeStr); | ||||||
|                 mPutMethod.addRequestHeader(OC_TOTAL_LENGTH_HEADER, totalLengthStr); |                 mPutMethod.addRequestHeader(OC_TOTAL_LENGTH_HEADER, totalLengthStr); | ||||||
| 
 | 
 | ||||||
|                 // Tell to the server what is the last modification date of the file to upload |                 mPutMethod.addRequestHeader(OC_CHUNK_X_OC_MTIME_HEADER, mFileLastModifTimestamp); | ||||||
|                 Long timeStampLong = System.currentTimeMillis()/1000; |  | ||||||
|                 String timeStamp = timeStampLong.toString(); |  | ||||||
|                 mPutMethod.addRequestHeader(OC_CHUNK_X_OC_MTIME_HEADER, timeStamp); |  | ||||||
| 
 | 
 | ||||||
|                 ((ChunkFromFileChannelRequestEntity) mEntity).setOffset(offset); |                 ((ChunkFromFileChannelRequestEntity) mEntity).setOffset(offset); | ||||||
|                 mPutMethod.setRequestEntity(mEntity); |                 mPutMethod.setRequestEntity(mEntity); | ||||||
|  | |||||||
| @ -67,6 +67,7 @@ public class UploadRemoteFileOperation extends RemoteOperation { | |||||||
|     protected String mLocalPath; |     protected String mLocalPath; | ||||||
|     protected String mRemotePath; |     protected String mRemotePath; | ||||||
|     protected String mMimeType; |     protected String mMimeType; | ||||||
|  |     protected String mFileLastModifTimestamp; | ||||||
|     protected PutMethod mPutMethod = null; |     protected PutMethod mPutMethod = null; | ||||||
|     protected boolean mForbiddenCharsInServer = false; |     protected boolean mForbiddenCharsInServer = false; | ||||||
|     protected String mRequiredEtag = null; |     protected String mRequiredEtag = null; | ||||||
| @ -76,14 +77,15 @@ public class UploadRemoteFileOperation extends RemoteOperation { | |||||||
| 
 | 
 | ||||||
|     protected RequestEntity mEntity = null; |     protected RequestEntity mEntity = null; | ||||||
| 
 | 
 | ||||||
| 	public UploadRemoteFileOperation(String localPath, String remotePath, String mimeType) { |     public UploadRemoteFileOperation(String localPath, String remotePath, String mimeType, String fileLastModifTimestamp) { | ||||||
|         mLocalPath = localPath; |         mLocalPath = localPath; | ||||||
|         mRemotePath = remotePath; |         mRemotePath = remotePath; | ||||||
|         mMimeType = mimeType; |         mMimeType = mimeType; | ||||||
|  |         mFileLastModifTimestamp = fileLastModifTimestamp; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| 	public UploadRemoteFileOperation(String localPath, String remotePath, String mimeType, String requiredEtag) { |     public UploadRemoteFileOperation(String localPath, String remotePath, String mimeType, String requiredEtag, String fileLastModifTimestamp) { | ||||||
| 		this(localPath, remotePath, mimeType); |         this(localPath, remotePath, mimeType, fileLastModifTimestamp); | ||||||
|         mRequiredEtag = requiredEtag; |         mRequiredEtag = requiredEtag; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| @ -154,10 +156,7 @@ public class UploadRemoteFileOperation extends RemoteOperation { | |||||||
|             } |             } | ||||||
|             mPutMethod.addRequestHeader(OC_TOTAL_LENGTH_HEADER, String.valueOf(f.length())); |             mPutMethod.addRequestHeader(OC_TOTAL_LENGTH_HEADER, String.valueOf(f.length())); | ||||||
| 
 | 
 | ||||||
|             // Tell to the server what is the last modification date of the file to upload |             mPutMethod.addRequestHeader(OC_X_OC_MTIME_HEADER, mFileLastModifTimestamp); | ||||||
|             Long timeStampLong = System.currentTimeMillis()/1000; |  | ||||||
|             String timeStamp = timeStampLong.toString(); |  | ||||||
|             mPutMethod.addRequestHeader(OC_X_OC_MTIME_HEADER, timeStamp); |  | ||||||
| 
 | 
 | ||||||
|             mPutMethod.setRequestEntity(mEntity); |             mPutMethod.setRequestEntity(mEntity); | ||||||
|             status = client.executeMethod(mPutMethod); |             status = client.executeMethod(mPutMethod); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user