Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check if file is a symlink with web editor (#3687) #445

Merged
merged 2 commits into from
Dec 22, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions conf/locale/TRANSLATORS
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Barış Arda Yılmaz <ardayilmazgamer AT gmail DOT com>
Camille Baronnet <gogs AT camillebaronnet DOT fr>
Christoph Kisfeld <christoph DOT kisfeld AT gmail DOT com>
Cysioland
Damaris Padieu <damizx AT hotmail DOT fr>
Daniel Speichert <daniel AT speichert DOT pl>
David Yzaguirre <dvdyzag AT gmail DOT com>
Dmitriy Nogay <me AT catwhocode DOT ga>
Expand Down
1 change: 1 addition & 0 deletions conf/locale/locale_de-DE.ini
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,7 @@ editor.cancel=Abbrechen
editor.filename_cannot_be_empty=Der Dateiname darf nicht leer sein.
editor.branch_already_exists=Branch '%s' existiert bereits in diesem Repository.
editor.directory_is_a_file='%s' im übergeordneten Verzeichnis ist eine Datei und kein Verzeichnis.
editor.file_is_a_symlink=Die Datei '%s' ist ein Symlink der nicht über den Web Editor bearbeitet werden kann.
editor.filename_is_a_directory=Die Datei '%s' existiert bereits als Verzeichnis in diesem Repository.
editor.file_editing_no_longer_exists=Die Datei '%s', welche Sie bearbeiten, existiert in diesem Repository nicht mehr.
editor.file_changed_while_editing=Seit dem Start der Bearbeitung hat sich die Datei geändert. <a target="_blank" rel="noopener" href="%s">Hier klicken</a> um die Änderungen zu sehen, oder nochmals <strong>Commit drücken</strong> um die Änderungen zu überschreiben.
Expand Down
1 change: 1 addition & 0 deletions conf/locale/locale_en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,7 @@ editor.cancel = Cancel
editor.filename_cannot_be_empty = Filename cannot be empty.
editor.branch_already_exists = Branch '%s' already exists in this repository.
editor.directory_is_a_file = Entry '%s' in the parent path is a file not a directory in this repository.
editor.file_is_a_symlink = The file '%s' is a symlink that cannot be modified from the web editor
editor.filename_is_a_directory = The filename '%s' is an existing directory in this repository.
editor.file_editing_no_longer_exists = The file '%s' you are editing no longer exists in the repository.
editor.file_changed_while_editing = File content has been changed since you started editing. <a target="_blank" rel="noopener" href="%s">Click here</a> to see what have been changed or <strong>press commit again</strong> to overwrite those changes.
Expand Down
1 change: 1 addition & 0 deletions conf/locale/locale_fr-FR.ini
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,7 @@ editor.cancel=Annuler
editor.filename_cannot_be_empty=Nom de fichier ne peut pas être vide.
editor.branch_already_exists=La branche '%s' existe déjà dans ce dépôt.
editor.directory_is_a_file=L'entrée '%s' dans le chemin d’accès parent est un fichier pas un répertoire dans ce dépôt.
editor.file_is_a_symlink=Le fichier '%s' est un lien symbolique qui ne peut pas être modifié par l'éditeur web
editor.filename_is_a_directory=Le nom de fichier '%s' existe déjà dans ce dépot.
editor.file_editing_no_longer_exists=Le fichier '%s' que vous modifiez n'existe plus dans le dépôt.
editor.file_changed_while_editing=Le contenu du fichier à changé depuis que vous avez commencé à l'éditer. <a target="_blank" rel="noopener" href="%s">Cliquez ici</a> pour voir ce qui à été modifié ou <strong>appuyez sur commit encore une fois</strong> pour remplacer ces changements.
Expand Down
1 change: 1 addition & 0 deletions conf/locale/locale_zh-CN.ini
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ editor.cancel=取消
editor.filename_cannot_be_empty=文件名不能为空。
editor.branch_already_exists=此仓库已存在名为 '%s' 的分支。
editor.directory_is_a_file=路径 '%s' 的父路径中包含此仓库已存在的文件名。
editor.file_is_a_symlink = '%s'数据是网页编辑器不能改变的符号链接。
editor.filename_is_a_directory=文件名 '%s' 是此仓库中已存在的目录名。
editor.file_editing_no_longer_exists=您编辑的文件 '%s' 已经不存在于此仓库中。
editor.file_changed_while_editing=文件内容在您进行编辑时已经发生变动。<a target="_blank" rel="noopener" href="%s">单击此处</a> 查看变动的具体内容,或者 <strong>再次提交</strong> 覆盖已发生的变动。
Expand Down
5 changes: 5 additions & 0 deletions routers/repo/editor.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,11 @@ func editFilePost(ctx *context.Context, form auth.EditRepoFileForm, isNewFile bo
return
}
} else {
if entry.IsLink() {
ctx.Data["Err_TreePath"] = true
ctx.RenderWithErr(ctx.Tr("repo.editor.file_is_a_symlink", part), EDIT_FILE, &form)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to replace the constant

return
}
if entry.IsDir() {
ctx.Data["Err_TreePath"] = true
ctx.RenderWithErr(ctx.Tr("repo.editor.filename_is_a_directory", part), tplEditFile, &form)
Expand Down