File tree 5 files changed +9
-8
lines changed
5 files changed +9
-8
lines changed Original file line number Diff line number Diff line change 9
9
{{ctx.Locale.Tr "repo.editor.commit_changes"}}
10
10
{{- end}}</h3>
11
11
<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>
13
13
</div>
14
14
<div class="field">
15
15
<textarea name="commit_message" placeholder="{{ctx.Locale.Tr "repo.editor.commit_message_desc"}}" rows="5">{{.commit_message}}</textarea>
60
60
<div class="quick-pull-branch-name {{if not (eq .commit_choice "commit-to-new-branch")}}gt-hidden{{end}}">
61
61
<div class="new-branch-name-input field {{if .Err_NewBranchName}}error{{end}}">
62
62
{{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"}}">
64
64
<span class="text-muted js-quick-pull-normalization-info"></span>
65
65
</div>
66
66
</div>
Original file line number Diff line number Diff line change 15
15
{{range $i, $v := .TreeNames}}
16
16
<div class="breadcrumb-divider">/</div>
17
17
{{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>
19
19
<span data-tooltip-content="{{ctx.Locale.Tr "repo.editor.filename_help"}}">{{svg "octicon-info"}}</span>
20
20
{{else}}
21
21
<span class="section"><a href="{{$.BranchLink}}/{{index $.TreePaths $i | PathEscapeSegments}}">{{$v}}</a></span>
Original file line number Diff line number Diff line change 15
15
<a class="section" href="{{$.BranchLink}}">{{.BranchName}}</a>
16
16
<span>{{ctx.Locale.Tr "repo.editor.or"}} <a href="{{$.BranchLink}}">{{ctx.Locale.Tr "repo.editor.cancel_lower"}}</a></span>
17
17
<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">
19
19
</div>
20
20
</div>
21
21
<div class="field">
Original file line number Diff line number Diff line change 13
13
{{range $i, $v := .TreeNames}}
14
14
<div class="breadcrumb-divider">/</div>
15
15
{{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>
17
17
<span data-tooltip-content="{{ctx.Locale.Tr "repo.editor.filename_help"}}">{{svg "octicon-info"}}</span>
18
18
{{else}}
19
19
<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';
2
2
3
3
// transform /path/to/file.ext to file.ext
4
4
export function basename ( path = '' ) {
5
- return path ? path . replace ( / ^ .* \/ / , '' ) : '' ;
5
+ const lastSlashIndex = path . lastIndexOf ( '/' ) ;
6
+ return lastSlashIndex < 0 ? path : path . substring ( lastSlashIndex + 1 ) ;
6
7
}
7
8
8
9
// transform /path/to/file.ext to .ext
9
10
export function extname ( path = '' ) {
10
- const [ _ , ext ] = / . + ( \. [ ^ . ] + ) $ / . exec ( path ) || [ ] ;
11
- return ext || '' ;
11
+ const lastPointIndex = path . lastIndexOf ( '.' ) ;
12
+ return lastPointIndex < 0 ? '' : path . substring ( lastPointIndex ) ;
12
13
}
13
14
14
15
// test whether a variable is an object
You can’t perform that action at this time.
0 commit comments