aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@users.noreply.github.com>2023-10-04 08:48:48 +0200
committerGitHub <noreply@github.com>2023-10-04 08:48:48 +0200
commit3f725824b1916896c04b1e9e3bf5cfa4ad4ad1ac (patch)
tree2f52db7a79f3acd97a65db8806e31a3fe6ac5f5f /apps
parentcf6e9a19c49b3aa5529ead275e0aeb2be902ab20 (diff)
parentd59151025366d11e3baa7fd16c2d987ba5a227a6 (diff)
downloadnextcloud-server-3f725824b1916896c04b1e9e3bf5cfa4ad4ad1ac.tar.gz
nextcloud-server-3f725824b1916896c04b1e9e3bf5cfa4ad4ad1ac.zip
Merge pull request #40756 from nextcloud/fix/encoded-source
Diffstat (limited to 'apps')
-rw-r--r--apps/files/js/file-upload.js10
-rw-r--r--apps/files/js/filelist.js8
-rw-r--r--apps/files/js/files.js6
-rw-r--r--apps/files/js/filesummary.js4
-rw-r--r--apps/files/js/mainfileinfodetailview.js2
-rw-r--r--apps/files/src/actions/deleteAction.ts2
-rw-r--r--apps/files/src/actions/moveOrCopyAction.ts4
-rw-r--r--apps/files/src/components/FileEntry.vue7
-rw-r--r--apps/files/src/newMenu/newFolder.ts2
-rw-r--r--apps/files/src/services/Files.ts3
-rw-r--r--apps/files_trashbin/src/actions/restoreAction.ts2
-rw-r--r--apps/files_trashbin/src/services/trashbin.ts2
12 files changed, 26 insertions, 26 deletions
diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js
index 61bd53eb35f..0301c1fe6ac 100644
--- a/apps/files/js/file-upload.js
+++ b/apps/files/js/file-upload.js
@@ -1063,8 +1063,8 @@ OC.Uploader.prototype = _.extend({
data.textStatus = 'notenoughspace';
data.errorThrown = t('files',
'Not enough free space, you are uploading {size1} but only {size2} is left', {
- 'size1': OC.Util.humanFileSize(selection.totalBytes),
- 'size2': OC.Util.humanFileSize(freeSpace)
+ 'size1': OC.Util.humanFileSize(selection.totalBytes, false, false),
+ 'size2': OC.Util.humanFileSize(freeSpace, false, false)
});
}
@@ -1302,9 +1302,9 @@ OC.Uploader.prototype = _.extend({
}
self._setProgressBarText(h, h, t('files', '{loadedSize} of {totalSize} ({bitrate})' , {
- loadedSize: OC.Util.humanFileSize(data.loaded),
- totalSize: OC.Util.humanFileSize(total),
- bitrate: OC.Util.humanFileSize(smoothBitrate / 8) + '/s'
+ loadedSize: OC.Util.humanFileSize(data.loaded, false, false),
+ totalSize: OC.Util.humanFileSize(total, false, false),
+ bitrate: OC.Util.humanFileSize(smoothBitrate / 8, false, false) + '/s'
}));
self._setProgressBarValue(progress);
self.trigger('progressall', e, data);
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index cfc21e909c0..7f5eade84ff 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -1798,7 +1798,7 @@
// size column
if (typeof(fileData.size) !== 'undefined' && fileData.size >= 0) {
- simpleSize = OC.Util.humanFileSize(parseInt(fileData.size, 10), true);
+ simpleSize = OC.Util.humanFileSize(parseInt(fileData.size, 10), true, false);
// rgb(118, 118, 118) / #767676
// min. color contrast for normal text on white background according to WCAG AA
sizeColor = Math.round(118-Math.pow((fileData.size/(1024*1024)), 2));
@@ -2609,7 +2609,7 @@
var oldSize = oldFile.data('size');
var newSize = oldSize + newFile.data('size');
oldFile.data('size', newSize);
- oldFile.find('td.filesize').text(OC.Util.humanFileSize(newSize));
+ oldFile.find('td.filesize').text(OC.Util.humanFileSize(newSize, false, false));
self.remove(fileName);
}
@@ -2752,7 +2752,7 @@
var oldSize = oldFile.data('size');
var newSize = oldSize + newFile.data('size');
oldFile.data('size', newSize);
- oldFile.find('td.filesize').text(OC.Util.humanFileSize(newSize));
+ oldFile.find('td.filesize').text(OC.Util.humanFileSize(newSize, false, false));
}
self.reload();
})
@@ -3463,7 +3463,7 @@
}
else {
this.$el.find('.selectedActions').removeClass('hidden');
- this.$el.find('.column-size a>span:first').text(OC.Util.humanFileSize(summary.totalSize));
+ this.$el.find('.column-size a>span:first').text(OC.Util.humanFileSize(summary.totalSize, false, false));
var directoryInfo = n('files', '%n folder', '%n folders', summary.totalDirs);
var fileInfo = n('files', '%n file', '%n files', summary.totalFiles);
diff --git a/apps/files/js/files.js b/apps/files/js/files.js
index 486e437a8aa..88a762ca9c7 100644
--- a/apps/files/js/files.js
+++ b/apps/files/js/files.js
@@ -101,8 +101,8 @@
&& response.data.total !== undefined
&& response.data.used !== undefined
&& response.data.usedSpacePercent !== undefined) {
- var humanUsed = OC.Util.humanFileSize(response.data.used, true);
- var humanTotal = OC.Util.humanFileSize(response.data.total, true);
+ var humanUsed = OC.Util.humanFileSize(response.data.used, true, false);
+ var humanTotal = OC.Util.humanFileSize(response.data.total, true, false);
if (response.data.quota > 0) {
$('#quota').attr('title', t('files', '{used}%', {used: Math.round(response.data.usedSpacePercent)}));
$('#quota progress').val(response.data.usedSpacePercent);
@@ -425,7 +425,7 @@ var createDragShadow = function(event) {
.attr('data-file', elem.name)
.attr('data-origin', elem.origin);
newtr.append($('<td class="filename"></td>').text(elem.name).css('background-size', 32));
- newtr.append($('<td class="size"></td>').text(OC.Util.humanFileSize(elem.size)));
+ newtr.append($('<td class="size"></td>').text(OC.Util.humanFileSize(elem.size, false, false)));
tbody.append(newtr);
if (elem.type === 'dir') {
newtr.find('td.filename')
diff --git a/apps/files/js/filesummary.js b/apps/files/js/filesummary.js
index 00f13249ff3..0e9b191510a 100644
--- a/apps/files/js/filesummary.js
+++ b/apps/files/js/filesummary.js
@@ -226,7 +226,7 @@
$dirInfo.html(n('files', '%n folder', '%n folders', this.summary.totalDirs));
$fileInfo.html(n('files', '%n file', '%n files', this.summary.totalFiles));
$hiddenInfo.html(' (' + n('files', 'including %n hidden', 'including %n hidden', this.summary.totalHidden) + ')');
- var fileSize = this.summary.sumIsPending ? t('files', 'Pending') : OC.Util.humanFileSize(this.summary.totalSize);
+ var fileSize = this.summary.sumIsPending ? t('files', 'Pending') : OC.Util.humanFileSize(this.summary.totalSize, false, false);
this.$el.find('.filesize').html(fileSize);
// Show only what's necessary (may be hidden)
@@ -263,7 +263,7 @@
// don't show the filesize column, if filesize is NaN (e.g. in trashbin)
var fileSize = '';
if (!isNaN(summary.totalSize)) {
- fileSize = summary.sumIsPending ? t('files', 'Pending') : OC.Util.humanFileSize(summary.totalSize);
+ fileSize = summary.sumIsPending ? t('files', 'Pending') : OC.Util.humanFileSize(summary.totalSize, false, false);
fileSize = '<td class="filesize">' + fileSize + '</td>';
}
diff --git a/apps/files/js/mainfileinfodetailview.js b/apps/files/js/mainfileinfodetailview.js
index b5093e5c251..45988a60a02 100644
--- a/apps/files/js/mainfileinfodetailview.js
+++ b/apps/files/js/mainfileinfodetailview.js
@@ -156,7 +156,7 @@
path: this.model.get('path'),
hasSize: this.model.has('size'),
sizeLabel: t('files', 'Size'),
- size: OC.Util.humanFileSize(this.model.get('size'), true),
+ size: OC.Util.humanFileSize(this.model.get('size'), true, false),
altSize: n('files', '%n byte', '%n bytes', this.model.get('size')),
dateLabel: t('files', 'Modified'),
altDate: OC.Util.formatDate(this.model.get('mtime')),
diff --git a/apps/files/src/actions/deleteAction.ts b/apps/files/src/actions/deleteAction.ts
index 18c18178cb7..f79872f1685 100644
--- a/apps/files/src/actions/deleteAction.ts
+++ b/apps/files/src/actions/deleteAction.ts
@@ -44,7 +44,7 @@ export const action = new FileAction({
async exec(node: Node) {
try {
- await axios.delete(node.source)
+ await axios.delete(node.encodedSource)
// Let's delete even if it's moved to the trashbin
// since it has been removed from the current view
diff --git a/apps/files/src/actions/moveOrCopyAction.ts b/apps/files/src/actions/moveOrCopyAction.ts
index 51113f7ba31..52ad4f2868d 100644
--- a/apps/files/src/actions/moveOrCopyAction.ts
+++ b/apps/files/src/actions/moveOrCopyAction.ts
@@ -86,7 +86,7 @@ export const handleCopyMoveNodeTo = async (node: Node, destination: Folder, meth
}
const relativePath = join(destination.path, node.basename)
- const destinationUrl = generateRemoteUrl(`dav/files/${getCurrentUser()?.uid}${relativePath}`)
+ const destinationUrl = generateRemoteUrl(encodePath(`dav/files/${getCurrentUser()?.uid}${relativePath}`))
logger.debug(`${method} ${node.basename} to ${destinationUrl}`)
// Set loading state
@@ -97,7 +97,7 @@ export const handleCopyMoveNodeTo = async (node: Node, destination: Folder, meth
try {
await axios({
method: method === MoveCopyAction.COPY ? 'COPY' : 'MOVE',
- url: encodeURI(node.source),
+ url: node.encodedSource,
headers: {
Destination: encodeURI(destinationUrl),
Overwrite: overwrite ? undefined : 'F',
diff --git a/apps/files/src/components/FileEntry.vue b/apps/files/src/components/FileEntry.vue
index fc7c0a4af51..275e8bb3aef 100644
--- a/apps/files/src/components/FileEntry.vue
+++ b/apps/files/src/components/FileEntry.vue
@@ -845,7 +845,7 @@ export default Vue.extend({
// Rename and move the file
async onRename() {
const oldName = this.source.basename
- const oldSource = this.source.source
+ const oldEncodedSource = this.source.encodedSource
const newName = this.newName.trim?.() || ''
if (newName === '') {
showError(this.t('files', 'Name cannot be empty'))
@@ -870,12 +870,13 @@ export default Vue.extend({
// Update node
this.source.rename(newName)
+ logger.debug('Moving file to', { destination: this.source.encodedSource, oldEncodedSource })
try {
await axios({
method: 'MOVE',
- url: oldSource,
+ url: oldEncodedSource,
headers: {
- Destination: encodeURI(this.source.source),
+ Destination: this.source.encodedSource,
},
})
diff --git a/apps/files/src/newMenu/newFolder.ts b/apps/files/src/newMenu/newFolder.ts
index 33fd113b7c3..a7fa38c706c 100644
--- a/apps/files/src/newMenu/newFolder.ts
+++ b/apps/files/src/newMenu/newFolder.ts
@@ -70,7 +70,7 @@ export const entry = {
async handler(context: Folder, content: Node[]) {
const contentNames = content.map((node: Node) => node.basename)
const name = getUniqueName(t('files', 'New folder'), contentNames)
- const { fileid, source } = await createNewFolder(context.source, name)
+ const { fileid, source } = await createNewFolder(context.encodedSource, encodeURIComponent(name))
// Create the folder in the store
const folder = new Folder({
diff --git a/apps/files/src/services/Files.ts b/apps/files/src/services/Files.ts
index c8756928191..c09be2d72ac 100644
--- a/apps/files/src/services/Files.ts
+++ b/apps/files/src/services/Files.ts
@@ -30,7 +30,6 @@ import { getCurrentUser } from '@nextcloud/auth'
import { getClient, rootPath } from './WebdavClient'
import { hashCode } from '../utils/hashUtils'
import logger from '../logger'
-import { encodePath } from '@nextcloud/paths'
const client = getClient()
@@ -45,7 +44,7 @@ export const resultToNode = function(node: FileStat): File | Folder {
const permissions = davParsePermissions(props?.permissions)
const owner = getCurrentUser()?.uid as string
- const source = generateRemoteUrl(encodePath('dav' + rootPath + node.filename))
+ const source = generateRemoteUrl('dav' + rootPath + node.filename)
const id = props?.fileid < 0
? hashCode(source)
: props?.fileid as number || 0
diff --git a/apps/files_trashbin/src/actions/restoreAction.ts b/apps/files_trashbin/src/actions/restoreAction.ts
index ab9ac784d7f..e03573a75a6 100644
--- a/apps/files_trashbin/src/actions/restoreAction.ts
+++ b/apps/files_trashbin/src/actions/restoreAction.ts
@@ -54,7 +54,7 @@ registerFileAction(new FileAction({
const destination = generateRemoteUrl(encodePath(`dav/trashbin/${getCurrentUser()?.uid}/restore/${node.basename}`))
await axios({
method: 'MOVE',
- url: node.source,
+ url: node.encodedSource,
headers: {
destination,
},
diff --git a/apps/files_trashbin/src/services/trashbin.ts b/apps/files_trashbin/src/services/trashbin.ts
index d9ac3c7c70c..9aef75ef6d5 100644
--- a/apps/files_trashbin/src/services/trashbin.ts
+++ b/apps/files_trashbin/src/services/trashbin.ts
@@ -46,7 +46,7 @@ const resultToNode = function(node: FileStat): File | Folder {
const nodeData = {
id: node.props?.fileid as number || 0,
- source: generateRemoteUrl(encodePath('dav' + rootPath + node.filename)),
+ source: generateRemoteUrl('dav' + rootPath + node.filename),
// do not show the mtime column
// mtime: new Date(node.lastmod),
mime: node.mime as string,