Fossil SCM
Fix (URL-decode) a hyperlink that gets into clipboard when user selects a line of code (or a range of lines) and clicks "copy-to-clipboard". This affects /file, /artifact and /whatis pages. This fix may be somewhat suboptimal or incomplete: it may be worth investigating why some submenu's links are mangled on a server's side and fix it there (hint: perhaps %T and %h formatting does not play well with style_submenu_*() family of functions, see also check-in [b982c00150] and post [forum:b8ea664a57]).
Commit
898151877f9281100047ef891b53fadb8d88021de94921aa4e6907ff75e8534c
Parent
68344d628ceb33f…
1 file changed
+6
-6
+6
-6
| --- src/fossil.numbered-lines.js | ||
| +++ src/fossil.numbered-lines.js | ||
| @@ -17,18 +17,18 @@ | ||
| 17 | 17 | } |
| 18 | 18 | } |
| 19 | 19 | if(!tbl) return /* no matching elements */; |
| 20 | 20 | const F = window.fossil, D = F.dom; |
| 21 | 21 | const tdLn = tbl.querySelector('td.line-numbers'); |
| 22 | - const lineState = { | |
| 23 | - urlArgs: (window.location.search||'?') | |
| 22 | + const urlArgsRaw = (window.location.search||'?') | |
| 24 | 23 | .replace(/&?\budc=[^&]*/,'') /* "update display prefs cookie" */ |
| 25 | 24 | .replace(/&?\bln=[^&]*/,'') /* inbound line number/range */ |
| 26 | - .replace('?&','?'), | |
| 27 | - start: 0, end: 0 | |
| 28 | - }; | |
| 29 | - | |
| 25 | + .replace('?&','?'); | |
| 26 | + var urlArgsDecoded = urlArgsRaw; | |
| 27 | + try{urlArgsDecoded = decodeURIComponent(urlArgsRaw);} | |
| 28 | + catch{} | |
| 29 | + const lineState = { urlArgs: urlArgsDecoded, start: 0, end: 0 }; | |
| 30 | 30 | const lineTip = new F.PopupWidget({ |
| 31 | 31 | style: { |
| 32 | 32 | cursor: 'pointer' |
| 33 | 33 | }, |
| 34 | 34 | refresh: function(){ |
| 35 | 35 |
| --- src/fossil.numbered-lines.js | |
| +++ src/fossil.numbered-lines.js | |
| @@ -17,18 +17,18 @@ | |
| 17 | } |
| 18 | } |
| 19 | if(!tbl) return /* no matching elements */; |
| 20 | const F = window.fossil, D = F.dom; |
| 21 | const tdLn = tbl.querySelector('td.line-numbers'); |
| 22 | const lineState = { |
| 23 | urlArgs: (window.location.search||'?') |
| 24 | .replace(/&?\budc=[^&]*/,'') /* "update display prefs cookie" */ |
| 25 | .replace(/&?\bln=[^&]*/,'') /* inbound line number/range */ |
| 26 | .replace('?&','?'), |
| 27 | start: 0, end: 0 |
| 28 | }; |
| 29 | |
| 30 | const lineTip = new F.PopupWidget({ |
| 31 | style: { |
| 32 | cursor: 'pointer' |
| 33 | }, |
| 34 | refresh: function(){ |
| 35 |
| --- src/fossil.numbered-lines.js | |
| +++ src/fossil.numbered-lines.js | |
| @@ -17,18 +17,18 @@ | |
| 17 | } |
| 18 | } |
| 19 | if(!tbl) return /* no matching elements */; |
| 20 | const F = window.fossil, D = F.dom; |
| 21 | const tdLn = tbl.querySelector('td.line-numbers'); |
| 22 | const urlArgsRaw = (window.location.search||'?') |
| 23 | .replace(/&?\budc=[^&]*/,'') /* "update display prefs cookie" */ |
| 24 | .replace(/&?\bln=[^&]*/,'') /* inbound line number/range */ |
| 25 | .replace('?&','?'); |
| 26 | var urlArgsDecoded = urlArgsRaw; |
| 27 | try{urlArgsDecoded = decodeURIComponent(urlArgsRaw);} |
| 28 | catch{} |
| 29 | const lineState = { urlArgs: urlArgsDecoded, start: 0, end: 0 }; |
| 30 | const lineTip = new F.PopupWidget({ |
| 31 | style: { |
| 32 | cursor: 'pointer' |
| 33 | }, |
| 34 | refresh: function(){ |
| 35 |