mirror of
https://github.com/owncloud/android-library.git
synced 2025-06-07 16:06:08 +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 TAG = ChunkedUploadRemoteFileOperation.class.getSimpleName();
|
||||
|
||||
public ChunkedUploadRemoteFileOperation(String storagePath, String remotePath, String mimeType){
|
||||
super(storagePath, remotePath, mimeType);
|
||||
public ChunkedUploadRemoteFileOperation(String storagePath, String remotePath, String mimeType, String fileLastModifTimestamp){
|
||||
super(storagePath, remotePath, mimeType, fileLastModifTimestamp);
|
||||
}
|
||||
|
||||
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
|
||||
@ -101,10 +101,7 @@ public class ChunkedUploadRemoteFileOperation extends UploadRemoteFileOperation
|
||||
mPutMethod.addRequestHeader(OC_CHUNK_SIZE_HEADER, chunkSizeStr);
|
||||
mPutMethod.addRequestHeader(OC_TOTAL_LENGTH_HEADER, totalLengthStr);
|
||||
|
||||
// Tell to the server what is the last modification date of the file to upload
|
||||
Long timeStampLong = System.currentTimeMillis()/1000;
|
||||
String timeStamp = timeStampLong.toString();
|
||||
mPutMethod.addRequestHeader(OC_CHUNK_X_OC_MTIME_HEADER, timeStamp);
|
||||
mPutMethod.addRequestHeader(OC_CHUNK_X_OC_MTIME_HEADER, mFileLastModifTimestamp);
|
||||
|
||||
((ChunkFromFileChannelRequestEntity) mEntity).setOffset(offset);
|
||||
mPutMethod.setRequestEntity(mEntity);
|
||||
|
@ -67,6 +67,7 @@ public class UploadRemoteFileOperation extends RemoteOperation {
|
||||
protected String mLocalPath;
|
||||
protected String mRemotePath;
|
||||
protected String mMimeType;
|
||||
protected String mFileLastModifTimestamp;
|
||||
protected PutMethod mPutMethod = null;
|
||||
protected boolean mForbiddenCharsInServer = false;
|
||||
protected String mRequiredEtag = null;
|
||||
@ -76,14 +77,15 @@ public class UploadRemoteFileOperation extends RemoteOperation {
|
||||
|
||||
protected RequestEntity mEntity = null;
|
||||
|
||||
public UploadRemoteFileOperation(String localPath, String remotePath, String mimeType) {
|
||||
public UploadRemoteFileOperation(String localPath, String remotePath, String mimeType, String fileLastModifTimestamp) {
|
||||
mLocalPath = localPath;
|
||||
mRemotePath = remotePath;
|
||||
mMimeType = mimeType;
|
||||
mFileLastModifTimestamp = fileLastModifTimestamp;
|
||||
}
|
||||
|
||||
public UploadRemoteFileOperation(String localPath, String remotePath, String mimeType, String requiredEtag) {
|
||||
this(localPath, remotePath, mimeType);
|
||||
public UploadRemoteFileOperation(String localPath, String remotePath, String mimeType, String requiredEtag, String fileLastModifTimestamp) {
|
||||
this(localPath, remotePath, mimeType, fileLastModifTimestamp);
|
||||
mRequiredEtag = requiredEtag;
|
||||
}
|
||||
|
||||
@ -154,10 +156,7 @@ public class UploadRemoteFileOperation extends RemoteOperation {
|
||||
}
|
||||
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
|
||||
Long timeStampLong = System.currentTimeMillis()/1000;
|
||||
String timeStamp = timeStampLong.toString();
|
||||
mPutMethod.addRequestHeader(OC_X_OC_MTIME_HEADER, timeStamp);
|
||||
mPutMethod.addRequestHeader(OC_X_OC_MTIME_HEADER, mFileLastModifTimestamp);
|
||||
|
||||
mPutMethod.setRequestEntity(mEntity);
|
||||
status = client.executeMethod(mPutMethod);
|
||||
|
Loading…
x
Reference in New Issue
Block a user