Skip to content

Commit

Permalink
Read the Header OC-Perm for the remote permissions on TUS.
Browse files Browse the repository at this point in the history
With this the client will save a subsequent PROPFIND request
after a TUS upload. It requires that the server sends the
OC-Perm header. oCIS will do that.
  • Loading branch information
Klaas Freitag authored and TheOneRing committed Oct 25, 2021
1 parent e50b658 commit 2c6ba1d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/libsync/propagateuploadtus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,18 @@ void PropagateUploadFileTUS::slotChunkFinished()
startNextChunk();
return;
}

// ==== handling when the upload is finished:
const QByteArray etag = getEtagFromReply(job->reply());
const QByteArray remPerms = job->reply()->rawHeader("OC-Perm");
if (!remPerms.isEmpty()) {
_item->_remotePerm = RemotePermissions::fromServerString(QString::fromUtf8(remPerms));
}

_finished = !etag.isEmpty();
_finished = !(etag.isEmpty() || _item->_remotePerm.isNull());
if (!_finished) {
// Either the ETag or the remote Permissions were not in the headers of the reply.
// Start a PROPFIND to fetch these data from the server.
auto check = new PropfindJob(propagator()->account(), propagator()->fullRemotePath(_item->_file));
_jobs.append(check);
check->setProperties({ "http://owncloud.org/ns:fileid", "http://owncloud.org/ns:permissions", "getetag" });
Expand Down

0 comments on commit 2c6ba1d

Please sign in to comment.