owncloud / web

:dragon_face: Next generation frontend for ownCloud Infinite Scale
https://owncloud.dev/clients/web/
GNU Affero General Public License v3.0
434 stars 159 forks source link

fix: enforce protocol in shortcut urls #11076

Closed kulmann closed 3 months ago

kulmann commented 3 months ago

Description

If the user types a URL without protocol and doesn't click on the proposed URL in the dropdown (which would include https:// as protocol), the resulting .url file wouldn't have a protocol in the URL. This PR fixes that by enforcing https:// as prefix for the user input if none was given. Technically this would've been possible by using unref(dropItemUrl) instead of unref(inputUrl), but I've decided to extract the body of dropItemUrl into a function and use that, because it would be confusing to use dropItemUrl as the final input on confirm.

Related Issue

Motivation and Context

Enforce url protocol so that mobile clients won't have trouble opening the URLs.

Types of changes

kulmann commented 3 months ago

Since we add the protocol to the file, we can omit the protocol rewrite in packages/web-pkg/src/composables/actions/files/useFileActionsOpenShortcut.ts

I think it still makes sense there. url files which were create with a different application might have been uploaded and not have a protocol in the url, we still want to be able to use them.

AlexAndBear commented 3 months ago

Since we add the protocol to the file, we can omit the protocol rewrite in packages/web-pkg/src/composables/actions/files/useFileActionsOpenShortcut.ts

I think it still makes sense there. url files which were create with a different application might have been uploaded and not have a protocol in the url, we still want to be able to use them.

Got you, but then the initial problem, that has been reported is still an issue on the clients side, when a user does this ;)

sonarcloud[bot] commented 3 months ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
100.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud