Skip to content
This repository has been archived by the owner on Jan 21, 2024. It is now read-only.

refactor: remove encodeURI handling of attachment paths. #568

Merged
merged 1 commit into from
May 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions src/components/Attachment/AttachmentDetailModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
</template>
<span slot="title">
普通链接:
<a-button class="!p-0" type="link" @click="handleCopyLink(`${encodeURI(attachment.path)}`)">
<a-button class="!p-0" type="link" @click="handleCopyLink(`${attachment.path}`)">
<a-icon type="copy" />
</a-button>
</span>
Expand All @@ -74,11 +74,7 @@
<span slot="description">![{{ attachment.name }}]({{ attachment.path }})</span>
<span slot="title">
Markdown 格式:
<a-button
class="!p-0"
type="link"
@click="handleCopyLink(`![${attachment.name}](${encodeURI(attachment.path)})`)"
>
<a-button class="!p-0" type="link" @click="handleCopyLink(`![${attachment.name}](${attachment.path})`)">
<a-icon type="copy" />
</a-button>
</span>
Expand Down
10 changes: 5 additions & 5 deletions src/components/Attachment/AttachmentSelectModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
<span v-if="!isImage(item)" class="attachments-group-item-type">{{ item.suffix }}</span>
<span
v-else
:style="{ backgroundImage: `url('${encodeURI(item.thumbPath)}')` }"
:style="{ backgroundImage: `url('${item.thumbPath}')` }"
class="attachments-group-item-img"
loading="lazy"
/>
Expand Down Expand Up @@ -259,15 +259,15 @@ export default {
return []
}
return this.list.selected.map(item => {
return `![${item.name}](${encodeURI(item.path)})`
return `![${item.name}](${item.path})`
})
},
htmlSyntaxList() {
if (!this.list.selected.length) {
return []
}
return this.list.selected.map(item => {
return `<img src="${encodeURI(item.path)}" alt="${item.name}">`
return `<img src="${item.path}" alt="${item.name}">`
})
}
},
Expand Down Expand Up @@ -378,8 +378,8 @@ export default {
if (!this.multiSelect) {
this.$emit('confirm', {
raw: [attachment],
markdown: [`![${attachment.name}](${encodeURI(attachment.path)})`],
html: [`<img src="${encodeURI(attachment.path)}" alt="${attachment.name}">`]
markdown: [`![${attachment.name}](${attachment.path})`],
html: [`<img src="${attachment.path}" alt="${attachment.name}">`]
})
this.modalVisible = false
return
Expand Down
2 changes: 1 addition & 1 deletion src/components/Editor/MarkdownEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export default {
const attachment = response.data
resolve({
name: attachment.name,
path: encodeURI(attachment.path)
path: attachment.path
})
})
.catch(e => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Input/AttachmentInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default {
},
handleSelectAttachment({ raw }) {
if (raw.length) {
this.$emit('input', encodeURI(raw[0].path))
this.$emit('input', raw[0].path)
}
},
focus() {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Post/PostSettingModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ export default {
*/
handleSelectPostThumbnail({ raw }) {
if (raw.length) {
this.form.model.thumbnail = encodeURI(raw[0].path)
this.form.model.thumbnail = raw[0].path
}
this.attachmentSelectVisible = false
},
Expand Down
2 changes: 1 addition & 1 deletion src/views/attachment/AttachmentList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
<span v-if="!isImage(item)" class="attachments-group-item-type">{{ item.suffix }}</span>
<span
v-else
:style="{ backgroundImage: `url('${encodeURI(item.thumbPath)}')` }"
:style="{ backgroundImage: `url('${item.thumbPath}')` }"
class="attachments-group-item-img"
loading="lazy"
/>
Expand Down
2 changes: 1 addition & 1 deletion src/views/sheet/components/SheetSettingModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ export default {
*/
handleSelectSheetThumbnail({ raw }) {
if (raw.length) {
this.form.model.thumbnail = encodeURI(raw[0].path)
this.form.model.thumbnail = raw[0].path
}
this.attachmentSelectVisible = false
},
Expand Down
2 changes: 1 addition & 1 deletion src/views/sheet/independent/PhotoList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
>
<div class="photo-thumb photos-group-item">
<span
:style="{ backgroundImage: `url('${encodeURI(item.thumbnail)}')` }"
:style="{ backgroundImage: `url('${item.thumbnail}')` }"
class="photos-group-item-img"
loading="lazy"
/>
Expand Down
4 changes: 2 additions & 2 deletions src/views/sheet/independent/components/PhotoFormModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ export default {
handleAttachmentSelected({ raw }) {
if (raw.length) {
const { path, thumbPath, name } = raw[0]
this.$set(this.form.model, 'url', encodeURI(path))
this.$set(this.form.model, 'thumbnail', encodeURI(thumbPath))
this.$set(this.form.model, 'url', path)
this.$set(this.form.model, 'thumbnail', thumbPath)
this.$set(this.form.model, 'name', name)
}
this.attachmentSelectModal.visible = false
Expand Down