Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 7e34c28d authored by tobiasKaminsky's avatar tobiasKaminsky Committed by AndyScherzinger
Browse files

return new eTag

parent da41f323
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -33,6 +33,8 @@ import org.apache.jackrabbit.webdav.client.methods.PropFindMethod;
import org.apache.jackrabbit.webdav.property.DavPropertyName;
import org.apache.jackrabbit.webdav.property.DavPropertyNameSet;

import java.util.ArrayList;

/**
 * Check if file is up to date, by checking only eTag
 */
@@ -69,8 +71,21 @@ public class CheckEtagOperation extends RemoteOperation {

                if (etag.equals(expectedEtag)) {
                    return new RemoteOperationResult(RemoteOperationResult.ResultCode.ETAG_UNCHANGED);
                } else {
                    RemoteOperationResult result = new RemoteOperationResult(
                            RemoteOperationResult.ResultCode.ETAG_CHANGED);

                    ArrayList<Object> list = new ArrayList<>();
                    list.add(etag);
                    result.setData(list);

                    return result;
                }
            }
            
            if (status == HttpStatus.SC_NOT_FOUND) {
                return new RemoteOperationResult(RemoteOperationResult.ResultCode.FILE_NOT_FOUND);
            }
        } catch (Exception e) {
            Log_OC.e(TAG, "Error while retrieving eTag");
        }