@@ -11,7 +11,7 @@ const handlersUtil = {
11
11
<button aria-label="Copy file contents to clipboard" class="js-file-clipboard btn btn-sm BtnGroup-item file-clipboard-button tooltipped tooltipped-s js-enhanced-github-copy-btn" data-copied-hint="Copied!" type="button" click="selectText()" data-clipboard-target="tbody">
12
12
Copy File
13
13
</button>
14
- <a href="${ data . download_url } " download="${ data . name } "
14
+ <a href="${ data . download_url } " download="${ encodeURIComponent ( data . name ) } "
15
15
aria-label="(Alt/Option/Ctrl + Click) to download File" class="js-file-download btn btn-sm BtnGroup-item file-download-button tooltipped tooltipped-s">
16
16
<span style="margin-right: 5px;">${ formattedFileSize } </span>
17
17
<svg class="octicon octicon-cloud-download" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16">
@@ -73,23 +73,24 @@ const handlersUtil = {
73
73
74
74
for ( var i = startIndex ; i < containerItems . length ; i ++ ) {
75
75
const commitElem = containerItems [ i ] . querySelector ( 'div:nth-of-type(3)' ) ;
76
- const isValidFile = data [ actualDataIndex ] . type === 'file' && data [ actualDataIndex ] . size !== 0 ;
76
+ const fileMetadata = data [ actualDataIndex ] ;
77
+ const isValidFile = fileMetadata . type === 'file' && fileMetadata . size !== 0 ;
77
78
78
79
if ( commitElem ) {
79
80
containerItems [ i ] . querySelector ( 'div:nth-of-type(2)' ) . classList . remove ( 'col-md-2' , 'mr-3' ) ;
80
81
containerItems [ i ] . querySelector ( 'div:nth-of-type(2)' ) . classList . add ( 'col-md-1' , 'mr-2' ) ;
81
82
82
- if ( isValidFile || data [ actualDataIndex ] . type === 'symlink' ) {
83
- const formattedFileSize = commonUtil . getFileSizeAndUnit ( data [ actualDataIndex ] ) ;
83
+ if ( isValidFile || fileMetadata . type === 'symlink' ) {
84
+ const formattedFileSize = commonUtil . getFileSizeAndUnit ( fileMetadata ) ;
84
85
85
86
const html = `
86
87
<div role="gridcell" class="mr-1 text-gray-light eg-download" style="width: 95px;">
87
88
<span class="css-truncate css-truncate-target d-block">
88
89
<span style="margin-right: 5px;">
89
90
${ formattedFileSize }
90
91
</span>
91
- <a style="float: right" href="${ data [ actualDataIndex ] . download_url } " title="(Alt/Option/Ctrl + Click) to download File" aria-label="(Alt/Option/Ctrl + Click) to download File" class="tooltipped tooltipped-s"
92
- download="${ data [ actualDataIndex ] . name } ">
92
+ <a style="float: right" href="${ fileMetadata . download_url } " title="(Alt/Option/Ctrl + Click) to download File" aria-label="(Alt/Option/Ctrl + Click) to download File" class="tooltipped tooltipped-s"
93
+ download="${ encodeURIComponent ( fileMetadata . name ) } ">
93
94
<svg class="octicon octicon-cloud-download" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16">
94
95
<path d="M9 12h2l-3 3-3-3h2V7h2v5zm3-8c0-.44-.91-3-4.5-3C5.08 1 3 2.92 3 5 1.02 5 0 6.52 0 8c0 1.53 1 3 3 3h3V9.7H3C1.38 9.7 1.3 8.28 1.3 8c0-.17.05-1.7 1.7-1.7h1.3V5c0-1.39 1.56-2.7 3.2-2.7 2.55 0 3.13 1.55 3.2 1.8v1.2H12c.81 0 2.7.22 2.7 2.2 0 2.09-2.25 2.2-2.7 2.2h-2V11h2c2.08 0 4-1.16 4-3.5C16 5.06 14.08 4 12 4z"></path>
95
96
</svg>
0 commit comments