Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/text.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJulien Veyssier <eneiluj@posteo.net>2022-05-13 12:31:29 +0300
committernextcloud-command <nextcloud-command@users.noreply.github.com>2022-05-13 12:34:05 +0300
commit934893dddaec20d5856617af9f572ac08f3d8a28 (patch)
tree79d883b7d2a7061dec491b331bb980478826fcb2 /src
parent2c0b293ff3224f8abc0c9853eb98bc261d1d88ba (diff)
manual backport of #2383, fix attachment link target generation, this also fixes cleanup when there are parenthesis in the file names
Signed-off-by: Julien Veyssier <eneiluj@posteo.net> Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
Diffstat (limited to 'src')
-rw-r--r--src/components/EditorWrapper.vue7
-rw-r--r--src/nodes/ImageView.vue5
2 files changed, 10 insertions, 2 deletions
diff --git a/src/components/EditorWrapper.vue b/src/components/EditorWrapper.vue
index 913528229..65cde179e 100644
--- a/src/components/EditorWrapper.vue
+++ b/src/components/EditorWrapper.vue
@@ -634,7 +634,12 @@ export default {
})
},
insertAttachmentImage(name, fileId, position = null) {
- const src = 'text://image?imageFileName=' + encodeURIComponent(name)
+ // inspired by the fixedEncodeURIComponent function suggested in
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent
+ const src = 'text://image?imageFileName='
+ + encodeURIComponent(name).replace(/[!'()*]/g, (c) => {
+ return '%' + c.charCodeAt(0).toString(16).toUpperCase()
+ })
// simply get rid of brackets to make sure link text is valid
// as it does not need to be unique and matching the real file name
const alt = name.replaceAll(/[[\]]/g, '')
diff --git a/src/nodes/ImageView.vue b/src/nodes/ImageView.vue
index 751ce2f84..1c6ecd70f 100644
--- a/src/nodes/ImageView.vue
+++ b/src/nodes/ImageView.vue
@@ -22,7 +22,10 @@
<template>
<NodeViewWrapper>
- <div class="image" :class="{'icon-loading': !loaded}" :data-src="src">
+ <div class="image"
+ data-component="image-view"
+ :class="{'icon-loading': !loaded}"
+ :data-src="src">
<div v-if="imageLoaded && isSupportedImage"
v-click-outside="() => showIcons = false"
class="image__view"