Commit Graph

36 Commits

Author SHA1 Message Date
zeripath 296814e887 Refactor editor upload, update and delete to use git plumbing and add LFS support (#5702)
* Use git plumbing for upload: #5621 repo_editor.go: UploadRepoFile

* Use git plumbing for upload: #5621 repo_editor.go: GetDiffPreview

* Use git plumbing for upload: #5621 repo_editor.go: DeleteRepoFile

* Use git plumbing for upload: #5621 repo_editor.go: UploadRepoFiles

* Move branch checkout functions out of repo_editor.go as they are no longer used there

* BUGFIX: The default permissions should be 100644

    This is a change from the previous code but is more in keeping
    with the default behaviour of git.

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Standardise cleanUploadFilename to more closely match git

See verify_path in: 7f4e641693/read-cache.c (L951)

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Redirect on bad paths

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Refactor to move the uploading functions out to a module

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Add LFS support

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Update upload.go attribution header

Upload.go is essentially the remnants of repo_editor.go. The remaining code is essentially unchanged from the Gogs code, hence the Gogs attribution.

* Delete upload files after session committed

* Ensure that GIT_AUTHOR_NAME etc. are valid for git

see #5774

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Add in test cases per @lafriks comment

* Add space between gitea and github imports

Signed-off-by: Andrew Thornton <art27@cantab.net>

* more examples in TestCleanUploadName

Signed-off-by: Andrew Thornton <art27@cantab.net>

* fix formatting

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Set the SSH_ORIGINAL_COMMAND to ensure hooks are run

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Switch off SSH_ORIGINAL_COMMAND

Signed-off-by: Andrew Thornton <art27@cantab.net>
2019-02-12 15:07:31 +02:00
zeripath fd1e8563f8 SECURITY: protect DeleteFilePost et al with cleanUploadFileName (#5631)
This commit wraps more of the TreePaths with cleanUploadFileName

Signed-off-by: Andrew Thornton <art27@cantab.net>
2019-01-04 11:08:26 -05:00
Lunny Xiao 4a02a783c4 fix bug on upload file name (#5571) 2018-12-20 21:32:11 -05:00
Lauris BH 181b3a8f09 Fix path cleanup in multiple places (#3871) 2018-05-01 09:46:04 +08:00
Morgan Bazalgette 65861900cd Handle refactor (#3339)
* Replace all ctx.Handle with ctx.ServerError or ctx.NotFound

* Change Handle(403) to NotFound, avoid using macaron's NotFound
2018-01-10 23:34:17 +02:00
Duncan Ogilvie 551f3cbe42 Memory usage improvements (#3013)
* govendor update code.gitea.io/git

Signed-off-by: Duncan Ogilvie <mr.exodia.tpodt@gmail.com>

* Greatly improve memory usage

Signed-off-by: Duncan Ogilvie <mr.exodia.tpodt@gmail.com>
2017-11-29 09:50:39 +08:00
Ethan Koenig 513375c429 Make URL scheme unambiguous (#2408)
* Make URL scheme unambiguous

Redirect old routes to new routes

* Fix redirects to new URL scheme, and update template

* Fix branches/_new endpoints, and update integration test
2017-10-30 10:04:25 +08:00
Lunny Xiao 1739e84ac0 improve protected branch to add whitelist support (#2451)
* improve protected branch to add whitelist support

* fix lint

* fix style check

* fix tests

* fix description on UI and import

* fix test

* bug fixed

* fix tests and languages

* move isSliceInt64Eq to util pkg; improve function names & typo
2017-09-14 16:16:22 +08:00
Lunny Xiao 228247511a repo/editor: fix breadcrumb path cuts parent dirs (#3859) (#2032) 2017-06-22 23:30:47 +08:00
Lauris BH 0144817971 Do not allow commiting to protected branch from online editor (#1502)
* Do not allow commiting to protected branch from online editor

* Add editor integration tests for adding new file and not allowing to add new file to protected branch
2017-05-02 08:49:55 +08:00
Lunny Xiao 0e1392501d Check if file is a symlink with web editor (#3687) (#445)
* Check if file is a symlink with web editor (#3687)

* editor checks for symlinks

* translate file_is_a_symlink message

* credit translation author

* fix error constant
2016-12-22 13:27:32 +01:00
Thomas Boerger 83ed234472 Integrate templates into bindata optionally (#314)
Integrated optional bindata for the templates
2016-12-06 18:58:31 +01:00
Lunny Xiao 94da472717 Golint fixed for modules/setting (#262)
* golint fixed for modules/setting

* typo fixed and renamed UNIXSOCKET to UnixSocket
2016-11-27 18:14:25 +08:00
Lunny Xiao 229ec927b9 Golint fixed for modules/template 2016-11-25 14:23:48 +08:00
Lunny Xiao 3917ed45de golint fixed for routers (#208) 2016-11-24 15:04:31 +08:00
Thibault Meyer ddee4c8b58
Normalize files with gofmt 2016-11-11 13:11:45 +01:00
Sandro Santilli 4247304f5a Update import paths from github.com/go-gitea to code.gitea.io (#135)
- Update import paths from github.com/go-gitea to code.gitea.io
- Fix import path for travis

See https://docs.travis-ci.com/user/languages/go#Go-Import-Path
2016-11-10 17:24:48 +01:00
Matthias Loibl 45c4539c61 Merge pull request #17 from LefsFlarey/issue/3666
Fixed 404 caused by unexpected question mark
2016-11-08 18:27:59 +01:00
Flare 01c5233b53
Fixed 404 caused by unexpected question mark
This fixes 404 caused when creating new files or wiki pages with question marks. Amended to force CI rebuild
2016-11-08 22:09:48 +08:00
Sandro Santilli 6e4252dad4 Replace gogits/git-module dependency with go-gitea/git (#94)
* Replace gogits/git-module dependency with go-gitea/git

Fixes #92

* Remove git alias for git module import (not needed)
2016-11-06 11:18:34 -02:00
Matthias Loibl 1f44b01e2a Fix imports found by goimports. 2016-11-05 17:56:35 +01:00
Thomas Boerger e05a5ca36c
Executed go fmt for all files 2016-11-04 23:45:06 +01:00
Rémy Boulanouar 2d68bd1ef9 Change import reference to match gitea instead of gogs (#37) 2016-11-03 10:29:56 -02:00
Unknwon dadd35b636 #3559 fix template error 2016-08-31 13:59:23 -07:00
Andrey Nering 9ac46fb983 Support Editorconfig on web editor 2016-08-30 20:30:47 -03:00
Unknwon 643142acab Web editor: support upload files 2016-08-30 05:23:59 -07:00
Unknwon 780cc2d110 router/repo: code refactoring 2016-08-30 02:08:38 -07:00
Unknwon 62b0dc4853 Web editor: fix cannot create new file in subdirectory 2016-08-29 00:10:21 -07:00
Unknwon 429c92c0ce #3516 enforce line ending to be \n from web editor 2016-08-28 05:32:10 -07:00
Unknwon ba27d71abe Web editor: improve edit file 2016-08-28 04:31:42 -07:00
Unknwon 0114fdcba4 Web editor: improve delete file process 2016-08-28 01:41:44 -07:00
Unknwon f8a48ffaad Web editor: improve code quality 2016-08-24 21:35:03 -07:00
Unknwon a00c932bbc General code quality improvement 2016-08-16 23:06:38 -07:00
Unknwon 2625193a48 models/repo_editor: improve code quality 2016-08-15 22:20:55 -07:00
Unknwon 8637e67e6f Fix outdated edit can’t overwrite changes 2016-08-15 02:06:35 -07:00
Unknwon 54e0ada9d5 Web editor: improve delete file 2016-08-14 23:52:24 -07:00