Skip to content

Commit

Permalink
fix handling fragment query string in new secret links
Browse files Browse the repository at this point in the history
  • Loading branch information
ianopolous committed Jul 7, 2024
1 parent 5906f11 commit 4a4a4bd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
18 changes: 13 additions & 5 deletions src/components/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -238,14 +238,22 @@ module.exports = {
var pw = props.linkpassword;
if (pw == null) {
pw = window.location.hash.substring(1);
if (pw.includes("?"))
if (pw.includes("?")) {
const queryParams = new URLSearchParams(pw.substring(pw.indexOf("?") + 1));
for (const [key, value] of queryParams) {
if (value == "true")
props[key] = true;
else if (value == "false")
props[key] = false;
else if (key == "args")
props[key] = JSON.parse(value);
else
props[key] = value;
}
pw = pw.substring(0, pw.indexOf("?"));
}
}
props.linkpassword = pw;
if (fragment.indexOf("download=true") > 0)
props.download = true;
if (fragment.indexOf("open=true") > 0)
props.open = true;
if (props.app == null)
props.app = "Drive";
return props;
Expand Down
4 changes: 3 additions & 1 deletion src/components/drive/SecretLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ module.exports = {
if (autoOpenOverride || link.autoOpen) {
args = "?open=true";
if (link.shareFolderWithFile) {
args += "&path=" + link.path.substring(1);// do not pass starting '/'
args += "&path=" + link.path;
args += "&args=%7B%22filename%22:%22" + link.filename + "%22%7D";
} else if (link.isFile) {
args += "&filename=" + link.filename;
Expand Down Expand Up @@ -207,6 +207,8 @@ module.exports = {
var path = this.link.path;
if (! path.endsWith("/"))
path = path+"/";
if (this.link.shareFolderWithFile)
return path;
return path + this.link.filename;
},
onChange: function () {
Expand Down

0 comments on commit 4a4a4bd

Please sign in to comment.