Skip to content

Commit

Permalink
Merge pull request #7765 from nextcloud/fix_5574
Browse files Browse the repository at this point in the history
Don't encode paths that will be passed to the davclient
  • Loading branch information
MorrisJobke authored Jan 10, 2018
2 parents 03a7d9b + d4f163b commit 00a823f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
3 changes: 2 additions & 1 deletion apps/dav/lib/Upload/UploadHome.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ function delete() {
}

function getName() {
return 'uploads';
list(,$name) = \Sabre\Uri\split($this->principalInfo['uri']);
return $name;
}

function setName($name) {
Expand Down
14 changes: 7 additions & 7 deletions apps/files/js/file-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ OC.FileUpload.prototype = {
) {
data.isChunked = true;
chunkFolderPromise = this.uploader.davClient.createDirectory(
'uploads/' + encodeURIComponent(OC.getCurrentUser().uid) + '/' + encodeURIComponent(this.getId())
'uploads/' + OC.getCurrentUser().uid + '/' + this.getId()
);
// TODO: if fails, it means same id already existed, need to retry
} else {
Expand Down Expand Up @@ -272,8 +272,8 @@ OC.FileUpload.prototype = {
}

return this.uploader.davClient.move(
'uploads/' + encodeURIComponent(uid) + '/' + encodeURIComponent(this.getId()) + '/.file',
'files/' + encodeURIComponent(uid) + '/' + OC.joinPaths(this.getFullPath(), this.getFileName()),
'uploads/' + uid + '/' + this.getId() + '/.file',
'files/' + uid + '/' + OC.joinPaths(this.getFullPath(), this.getFileName()),
true,
headers
);
Expand All @@ -282,7 +282,7 @@ OC.FileUpload.prototype = {
_deleteChunkFolder: function() {
// delete transfer directory for this upload
this.uploader.davClient.remove(
'uploads/' + encodeURIComponent(OC.getCurrentUser().uid) + '/' + encodeURIComponent(this.getId())
'uploads/' + OC.getCurrentUser().uid + '/' + this.getId()
);
},

Expand Down Expand Up @@ -1166,9 +1166,9 @@ OC.Uploader.prototype = _.extend({
var chunkId = range.split('/')[0].split('-')[0];
data.url = OC.getRootPath() +
'/remote.php/dav/uploads' +
'/' + encodeURIComponent(OC.getCurrentUser().uid) +
'/' + encodeURIComponent(upload.getId()) +
'/' + encodeURIComponent(chunkId);
'/' + OC.getCurrentUser().uid +
'/' + upload.getId() +
'/' + chunkId;
delete data.contentRange;
delete data.headers['Content-Range'];
});
Expand Down

0 comments on commit 00a823f

Please sign in to comment.