Fix #14: Do not add a slash between path and filename
Signed-off-by: James Ketrenos <james_git@ketrenos.com>
This commit is contained in:
parent
903dfb6831
commit
87ffebd737
@ -242,7 +242,7 @@ Polymer({
|
||||
console.log("Download tapped");
|
||||
|
||||
var anchor = document.createElement('a');
|
||||
anchor.href = this.base + this.item.path + "/" + this.item.filename;
|
||||
anchor.href = this.base + this.item.path + this.item.filename;
|
||||
anchor.setAttribute("download", this.src.replace(/.*\/([^/]+)$/, "$1"));
|
||||
anchor.style.display = "none";
|
||||
document.body.appendChild(anchor);
|
||||
@ -355,10 +355,15 @@ Polymer({
|
||||
attached: function() {
|
||||
var base = document.querySelector("base");
|
||||
if (base) {
|
||||
this.base = new URL(base.href).pathname.replace(/\/$/, ""); /* Remove trailing slash if there */
|
||||
base = new URL(base.href).pathname.replace(/\/$/, ""); /* Remove trailing slash if there */
|
||||
} else {
|
||||
this.base = "";
|
||||
base = "";
|
||||
}
|
||||
/* If base is configured, add a trailing slash */
|
||||
if (base.length) {
|
||||
base += "/";
|
||||
}
|
||||
this.base = base;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
Loading…
x
Reference in New Issue
Block a user