File tree Expand file tree Collapse file tree 5 files changed +9
-8
lines changed Expand file tree Collapse file tree 5 files changed +9
-8
lines changed Original file line number Diff line number Diff line change 99 {{ctx.Locale.Tr "repo.editor.commit_changes"}}
1010 {{- end}}</h3>
1111 <div class="field">
12- <input name="commit_summary" placeholder="{{if .PageIsDelete}}{{ctx.Locale.Tr "repo.editor.delete" .TreePath}}{{else if .PageIsUpload}}{{ctx.Locale.Tr "repo.editor.upload_files_to_dir" .TreePath}}{{else if .IsNewFile}}{{ctx.Locale.Tr "repo.editor.add_tmpl"}}{{else if .PageIsPatch}}{{ctx.Locale.Tr "repo.editor.patch"}}{{else}}{{ctx.Locale.Tr "repo.editor.update" .TreePath}}{{end}}" value="{{.commit_summary}}" autofocus>
12+ <input name="commit_summary" maxlength="100" placeholder="{{if .PageIsDelete}}{{ctx.Locale.Tr "repo.editor.delete" .TreePath}}{{else if .PageIsUpload}}{{ctx.Locale.Tr "repo.editor.upload_files_to_dir" .TreePath}}{{else if .IsNewFile}}{{ctx.Locale.Tr "repo.editor.add_tmpl"}}{{else if .PageIsPatch}}{{ctx.Locale.Tr "repo.editor.patch"}}{{else}}{{ctx.Locale.Tr "repo.editor.update" .TreePath}}{{end}}" value="{{.commit_summary}}" autofocus>
1313 </div>
1414 <div class="field">
1515 <textarea name="commit_message" placeholder="{{ctx.Locale.Tr "repo.editor.commit_message_desc"}}" rows="5">{{.commit_message}}</textarea>
6060 <div class="quick-pull-branch-name {{if not (eq .commit_choice "commit-to-new-branch")}}gt-hidden{{end}}">
6161 <div class="new-branch-name-input field {{if .Err_NewBranchName}}error{{end}}">
6262 {{svg "octicon-git-branch"}}
63- <input type="text" name="new_branch_name" value="{{.new_branch_name}}" class="input-contrast gt-mr-2 js-quick-pull-new-branch-name" placeholder="{{ctx.Locale.Tr "repo.editor.new_branch_name_desc"}}" {{if eq .commit_choice "commit-to-new-branch"}}required{{end}} title="{{ctx.Locale.Tr "repo.editor.new_branch_name"}}">
63+ <input type="text" name="new_branch_name" maxlength="100" value="{{.new_branch_name}}" class="input-contrast gt-mr-2 js-quick-pull-new-branch-name" placeholder="{{ctx.Locale.Tr "repo.editor.new_branch_name_desc"}}" {{if eq .commit_choice "commit-to-new-branch"}}required{{end}} title="{{ctx.Locale.Tr "repo.editor.new_branch_name"}}">
6464 <span class="text-muted js-quick-pull-normalization-info"></span>
6565 </div>
6666 </div>
Original file line number Diff line number Diff line change 1515 {{range $i, $v := .TreeNames}}
1616 <div class="breadcrumb-divider">/</div>
1717 {{if eq $i $l}}
18- <input id="file-name" value="{{$v}}" placeholder="{{ctx.Locale.Tr "repo.editor.name_your_file"}}" data-editorconfig="{{$.EditorconfigJson}}" required autofocus>
18+ <input id="file-name" maxlength="500" value="{{$v}}" placeholder="{{ctx.Locale.Tr "repo.editor.name_your_file"}}" data-editorconfig="{{$.EditorconfigJson}}" required autofocus>
1919 <span data-tooltip-content="{{ctx.Locale.Tr "repo.editor.filename_help"}}">{{svg "octicon-info"}}</span>
2020 {{else}}
2121 <span class="section"><a href="{{$.BranchLink}}/{{index $.TreePaths $i | PathEscapeSegments}}">{{$v}}</a></span>
Original file line number Diff line number Diff line change 1515 <a class="section" href="{{$.BranchLink}}">{{.BranchName}}</a>
1616 <span>{{ctx.Locale.Tr "repo.editor.or"}} <a href="{{$.BranchLink}}">{{ctx.Locale.Tr "repo.editor.cancel_lower"}}</a></span>
1717 <input type="hidden" id="tree_path" name="tree_path" value="" required>
18- <input id="file-name" type="hidden" value="diff.patch">
18+ <input id="file-name" maxlength="500" type="hidden" value="diff.patch">
1919 </div>
2020 </div>
2121 <div class="field">
Original file line number Diff line number Diff line change 1313 {{range $i, $v := .TreeNames}}
1414 <div class="breadcrumb-divider">/</div>
1515 {{if eq $i $l}}
16- <input type="text" id="file-name" value="{{$v}}" placeholder="{{ctx.Locale.Tr "repo.editor.add_subdir"}}" autofocus>
16+ <input type="text" id="file-name" maxlength="500" value="{{$v}}" placeholder="{{ctx.Locale.Tr "repo.editor.add_subdir"}}" autofocus>
1717 <span data-tooltip-content="{{ctx.Locale.Tr "repo.editor.filename_help"}}">{{svg "octicon-info"}}</span>
1818 {{else}}
1919 <span class="section"><a href="{{$.BranchLink}}/{{index $.TreePaths $i | PathEscapeSegments}}">{{$v}}</a></span>
Original file line number Diff line number Diff line change @@ -2,13 +2,14 @@ import {encode, decode} from 'uint8-to-base64';
22
33// transform /path/to/file.ext to file.ext
44export function basename ( path = '' ) {
5- return path ? path . replace ( / ^ .* \/ / , '' ) : '' ;
5+ const lastSlashIndex = path . lastIndexOf ( '/' ) ;
6+ return lastSlashIndex < 0 ? path : path . substring ( lastSlashIndex + 1 ) ;
67}
78
89// transform /path/to/file.ext to .ext
910export function extname ( path = '' ) {
10- const [ _ , ext ] = / . + ( \. [ ^ . ] + ) $ / . exec ( path ) || [ ] ;
11- return ext || '' ;
11+ const lastPointIndex = path . lastIndexOf ( '.' ) ;
12+ return lastPointIndex < 0 ? '' : path . substring ( lastPointIndex ) ;
1213}
1314
1415// test whether a variable is an object
You can’t perform that action at this time.
0 commit comments