Browse Source

Web editor: fix cannot create new file in subdirectory

tags/v0.9.99
Unknwon 7 years ago
parent
commit
62b0dc4853

+ 1
- 1
README.md View File



![](https://github.com/gogits/gogs/blob/master/public/img/gogs-large-resize.png?raw=true) ![](https://github.com/gogits/gogs/blob/master/public/img/gogs-large-resize.png?raw=true)


##### Current tip version: 0.9.92 (see [Releases](https://github.com/gogits/gogs/releases) for binary versions)
##### Current tip version: 0.9.93 (see [Releases](https://github.com/gogits/gogs/releases) for binary versions)


| Web | UI | Preview | | Web | UI | Preview |
|:-------------:|:-------:|:-------:| |:-------------:|:-------:|:-------:|

+ 1
- 0
conf/locale/locale_en-US.ini View File

editor.file_changed_while_editing = File content has been changed since you started editing. <a target="_blank" href="%s">Click here</a> to see what have been changed or <strong>press commit again</strong> to overwrite those changes. editor.file_changed_while_editing = File content has been changed since you started editing. <a target="_blank" href="%s">Click here</a> to see what have been changed or <strong>press commit again</strong> to overwrite those changes.
editor.file_already_exists = A file with name '%s' already exists in this repository. editor.file_already_exists = A file with name '%s' already exists in this repository.
editor.no_changes_to_show = There are no changes to show. editor.no_changes_to_show = There are no changes to show.
editor.fail_to_update_file = Failed to update/create file '%s' with error: %v
upload_files = Upload files upload_files = Upload files
upload_file = Upload file upload_file = Upload file
add_files_to_dir = Add files to %s add_files_to_dir = Add files to %s

+ 1
- 1
gogs.go View File

"github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/modules/setting"
) )


const APP_VER = "0.9.92.0828"
const APP_VER = "0.9.93.0829"


func init() { func init() {
runtime.GOMAXPROCS(runtime.NumCPU()) runtime.GOMAXPROCS(runtime.NumCPU())

+ 4
- 2
models/repo_editor.go View File

} }


localPath := repo.LocalCopyPath() localPath := repo.LocalCopyPath()
oldFilePath := path.Join(localPath, opts.OldTreeName)
filePath := path.Join(localPath, opts.NewTreeName) filePath := path.Join(localPath, opts.NewTreeName)
os.MkdirAll(path.Dir(filePath), os.ModePerm) os.MkdirAll(path.Dir(filePath), os.ModePerm)


} }
} }


// If update a file, move if file name change.
if len(opts.OldTreeName) > 0 && len(opts.NewTreeName) > 0 && opts.OldTreeName != opts.NewTreeName {
// Ignore move step if it's a new file under a directory.
// Otherwise, move the file when name changed.
if com.IsFile(oldFilePath) && opts.OldTreeName != opts.NewTreeName {
if err = git.MoveFile(localPath, opts.OldTreeName, opts.NewTreeName); err != nil { if err = git.MoveFile(localPath, opts.OldTreeName, opts.NewTreeName); err != nil {
return fmt.Errorf("git mv %s %s: %v", opts.OldTreeName, opts.NewTreeName, err) return fmt.Errorf("git mv %s %s: %v", opts.OldTreeName, opts.NewTreeName, err)
} }

+ 2
- 2
modules/bindata/bindata.go
File diff suppressed because it is too large
View File


+ 2
- 2
modules/mailer/mailer.go View File

return fmt.Errorf("NewClient: %v", err) return fmt.Errorf("NewClient: %v", err)
} }


if !setting.MailService.DisableHelo {
hostname := setting.MailService.HeloHostname
if !opts.DisableHelo {
hostname := opts.HeloHostname
if len(hostname) == 0 { if len(hostname) == 0 {
hostname, err = os.Hostname() hostname, err = os.Hostname()
if err != nil { if err != nil {

+ 1
- 1
public/css/gogs.css View File

.repository #clone-panel { .repository #clone-panel {
margin-top: -8px; margin-top: -8px;
width: 100%; width: 100%;
padding-left: 20px;
} }
.repository #clone-panel input { .repository #clone-panel input {
border-radius: 0; border-radius: 0;
.repository.file.list #file-buttons { .repository.file.list #file-buttons {
font-weight: normal; font-weight: normal;
margin-top: -3px; margin-top: -3px;
padding-right: 20px;
} }
.repository.file.list #file-buttons .ui.button { .repository.file.list #file-buttons .ui.button {
padding: 8px 10px; padding: 8px 10px;

+ 1
- 1
public/less/_repository.less View File

#clone-panel { #clone-panel {
margin-top: -8px; margin-top: -8px;
width: 100%; width: 100%;
padding-left: 20px;


input { input {
border-radius: 0; border-radius: 0;
#file-buttons { #file-buttons {
font-weight: normal; font-weight: normal;
margin-top: -3px; margin-top: -3px;
padding-right: 20px;
.ui.button { .ui.button {
padding: 8px 10px; padding: 8px 10px;
} }

+ 1
- 1
routers/repo/editor.go View File

IsNewFile: isNewFile, IsNewFile: isNewFile,
}); err != nil { }); err != nil {
ctx.Data["Err_TreePath"] = true ctx.Data["Err_TreePath"] = true
ctx.RenderWithErr(ctx.Tr("repo.editor.failed_to_update_file", err), EDIT_FILE, &form)
ctx.RenderWithErr(ctx.Tr("repo.editor.fail_to_update_file", form.TreePath, err), EDIT_FILE, &form)
return return
} }



+ 1
- 1
templates/.VERSION View File

0.9.92.0828
0.9.93.0829

Loading…
Cancel
Save