Skip to content

Commit

Permalink
Merge pull request #11078 from owncloud/merge-stable-8.0-to-master-20…
Browse files Browse the repository at this point in the history
…240620

Merge stable 8.0 to master
  • Loading branch information
JammingBen authored Jun 21, 2024
2 parents cdf19b9 + e4d14be commit a61cc35
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Enforce shortcut URL protocol

We've fixed a bug where the protocol in shortcut URLs was not enforced. Now, the shortcut URL always starts `https://` if no protocol is provided by the user.

https://github.com/owncloud/web/issues/11063
https://github.com/owncloud/web/pull/11076
14 changes: 9 additions & 5 deletions packages/web-pkg/src/components/CreateShortcutModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,16 @@ export default defineComponent({
const isDropOpen = ref(false)
let markInstance: Mark = null
const dropItemUrl = computed(() => {
let url = unref(inputUrl).trim()
const getInputUrlWithProtocol = (input: string) => {
let url = input.trim()
if (isMaybeUrl(url)) {
return url
}
return `https://${url}`
}
const dropItemUrl = computed(() => {
return getInputUrlWithProtocol(unref(inputUrl))
})
const fileAlreadyExists = computed(
Expand Down Expand Up @@ -360,7 +362,9 @@ export default defineComponent({
const onConfirm = async () => {
try {
// Omit possible xss code
const sanitizedUrl = DOMPurify.sanitize(unref(inputUrl), { USE_PROFILES: { html: true } })
const sanitizedUrl = DOMPurify.sanitize(getInputUrlWithProtocol(unref(inputUrl)), {
USE_PROFILES: { html: true }
})
const content = `[InternetShortcut]\nURL=${sanitizedUrl}`
const path = urlJoin(unref(currentFolder).path, `${unref(inputFilename)}.url`)
Expand Down

0 comments on commit a61cc35

Please sign in to comment.