Skip to content

Commit

Permalink
luci-mod-system: flash.js: fix mtdname on download
Browse files Browse the repository at this point in the history
The previous change did not work as intended for
partitions with _ in the name. I.e "0:qsee_1".
It would output an error "Invalid characters in filename".

So fix this by matching and replacing any
character except for a-z and 0-9 with "-".

Example "0:qsee_1" = I.e "0-qsee-1".

Signed-off-by: Kristian Skramstad <[email protected]>
  • Loading branch information
skramstad authored and systemcrash committed May 15, 2024
1 parent 13dd9c4 commit c4eaea7
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ return view.extend({
handleBlock: function(hostname, ev) {
var mtdblock = dom.parent(ev.target, '.cbi-section').querySelector('[data-name="mtdselect"] select');
var mtdnumber = mtdblock.value;
var mtdname = mtdblock.selectedOptions[0].text;
var mtdname = mtdblock.selectedOptions[0].text.replace(/([^a-zA-Z0-9]+)/g, '-');
var form = E('form', {
'method': 'post',
'action': L.env.cgi_base + '/cgi-download',
Expand Down

0 comments on commit c4eaea7

Please sign in to comment.