diff --git a/frontend/elements/photo-lightbox.html b/frontend/elements/photo-lightbox.html
index 7e1f238..6d7ca9e 100644
--- a/frontend/elements/photo-lightbox.html
+++ b/frontend/elements/photo-lightbox.html
@@ -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;
}
});