Skip to content

Commit 7b38f14

Browse files
authored
Merge pull request #3037 from nextcloud/backport/3025/stable28
[stable28] fix: svg rendering
2 parents 5956897 + 625c494 commit 7b38f14

File tree

9 files changed

+20
-13
lines changed

9 files changed

+20
-13
lines changed

js/viewer-init.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/viewer-init.js.LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
4545
*/
4646

47-
/*! @license DOMPurify 3.1.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.6/LICENSE */
47+
/*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */
4848

4949
/*! For license information please see index.js.LICENSE.txt */
5050

js/viewer-init.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/viewer-main.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/viewer-main.js.LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
3838
*/
3939

40-
/*! @license DOMPurify 3.1.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.6/LICENSE */
40+
/*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */
4141

4242
/*! For license information please see index.js.LICENSE.txt */
4343

js/viewer-main.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 8 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
"@skjnldsv/vue-plyr": "^7.4.0",
5858
"camelcase": "^8.0.0",
5959
"debounce": "^1.2.1",
60+
"dompurify": "^3.3.1",
6061
"filerobot-image-editor": "^4.8.1",
6162
"nextcloud-server": "^0.15.10",
6263
"path-parse": "^1.0.7",

src/components/Images.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787

8888
<script>
8989
import PlayCircleOutline from 'vue-material-design-icons/PlayCircleOutline.vue'
90+
import DOMPurify from 'dompurify'
9091
9192
import axios from '@nextcloud/axios'
9293
import { basename } from '@nextcloud/paths'
@@ -229,7 +230,8 @@ export default {
229230
*/
230231
async getBase64FromImage() {
231232
const file = await axios.get(this.src)
232-
return `data:${this.mime};base64,${btoa(file.data)}`
233+
const sanitized = DOMPurify.sanitize(file.data)
234+
return `data:${this.mime};base64,${btoa(unescape(encodeURIComponent(sanitized)))}`
233235
},
234236
235237
/**

0 commit comments

Comments
 (0)