Fossil SCM

Seem to have resolved the broken download names for chat-posted files.

stephan 2020-12-23 07:12 chatroom-dev
Commit b604154c3822b45e4b0be16d3373b9fd249b8a3da715cb4bec3de61a98521904
1 file changed +3 -1
+3 -1
--- src/chat.js
+++ src/chat.js
@@ -150,11 +150,13 @@
150150
img.src = "chat-download/" + m.msgid;
151151
span.appendChild(img);
152152
}else{
153153
let a = document.createElement("a");
154154
let txt = "(" + m.fname + " " + m.fsize + " bytes)";
155
- a.href = window.fossil.rootPath+'chat-download/' + m.msgid;
155
+ a.href = window.fossil.rootPath+
156
+ 'chat-download/' + m.msgid+'/'+encodeURIComponent(m.fname);
157
+ // ^^^ add m.fname to URL to cause downloaded file to have that name.
156158
a.appendChild(textNode(txt));
157159
span.appendChild(a);
158160
}
159161
let br = document.createElement("br");
160162
br.style.clear = "both";
161163
--- src/chat.js
+++ src/chat.js
@@ -150,11 +150,13 @@
150 img.src = "chat-download/" + m.msgid;
151 span.appendChild(img);
152 }else{
153 let a = document.createElement("a");
154 let txt = "(" + m.fname + " " + m.fsize + " bytes)";
155 a.href = window.fossil.rootPath+'chat-download/' + m.msgid;
 
 
156 a.appendChild(textNode(txt));
157 span.appendChild(a);
158 }
159 let br = document.createElement("br");
160 br.style.clear = "both";
161
--- src/chat.js
+++ src/chat.js
@@ -150,11 +150,13 @@
150 img.src = "chat-download/" + m.msgid;
151 span.appendChild(img);
152 }else{
153 let a = document.createElement("a");
154 let txt = "(" + m.fname + " " + m.fsize + " bytes)";
155 a.href = window.fossil.rootPath+
156 'chat-download/' + m.msgid+'/'+encodeURIComponent(m.fname);
157 // ^^^ add m.fname to URL to cause downloaded file to have that name.
158 a.appendChild(textNode(txt));
159 span.appendChild(a);
160 }
161 let br = document.createElement("br");
162 br.style.clear = "both";
163

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button