Commit ab82b03d authored by Yusei Tahara's avatar Yusei Tahara

[erp5_web_renderjs_ui] Support UTF-8 filename download.

parent 81efe61e
...@@ -589,10 +589,17 @@ and handling data send&receive. ...@@ -589,10 +589,17 @@ and handling data send&receive.
.declareJob("forceDownload", function forceDownload(attachment) { .declareJob("forceDownload", function forceDownload(attachment) {
/*jslint regexp: true */ /*jslint regexp: true */
var attachment_data = attachment.target.response, var attachment_data = attachment.target.response,
filename_utf8_quoted = /(?:^|;)\s*filename\*=UTF-8''?([^";]+)/i.exec(
attachment.target.getResponseHeader("Content-Disposition") || ""
),
filename = /(?:^|;)\s*filename\s*=\s*"?([^";]+)/i.exec( filename = /(?:^|;)\s*filename\s*=\s*"?([^";]+)/i.exec(
attachment.target.getResponseHeader("Content-Disposition") || "" attachment.target.getResponseHeader("Content-Disposition") || ""
), ),
a_tag = document.createElement("a"); a_tag = document.createElement("a");
if (filename_utf8_quoted) {
filename = filename_utf8_quoted;
filename[1] = decodeURI(filename[1]);
}
/*jslint regexp: false */ /*jslint regexp: false */
if (attachment.target.responseType !== "blob") { if (attachment.target.responseType !== "blob") {
......
...@@ -228,7 +228,7 @@ ...@@ -228,7 +228,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>976.34271.30288.29832</string> </value> <value> <string>978.9875.57005.56541</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -246,7 +246,7 @@ ...@@ -246,7 +246,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1561044454.34</float> <float>1567358955.05</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment