Make AppDataPath absolute against the AppWorkPath if it is not#19815
Conversation
There are multiple repeated issues whereby a non-absolute provided APP_DATA_PATH causes strange issues. This PR simply absolutes the APP_DATA_PATH against the AppWorkPath if its not so. It also ensures that AppWorkPath is also always absolute. Ref go-gitea#19367 Signed-off-by: Andrew Thornton <art27@cantab.net>
|
Should we log a warn or info now we are ensuring absolute paths against workpath? Either way this LGTM |
|
This is a breaking change for all existing Gitea installations that have a relative AppDataPath in app.ini that is not against AppWorkPath. |
| workPath = appPath[:i] | ||
| } | ||
| } | ||
| workPath = strings.ReplaceAll(workPath, "\\", "/") |
There was a problem hiding this comment.
filepath.Join can deal with backslashes on Windows. It doesn't need such hacks. After all, backslash is a valid path character on many file sytems.
There was a problem hiding this comment.
This is to be consistent with the rest of the filepath munging in this file.
- add log service - cd into $HOME before running: fixes issues with APP_DATA_PATH being a relative path, which is the default in the example config. See [1] [1] go-gitea/gitea#19367
Signed-off-by: Andrew Thornton <art27@cantab.net>
Have done so. |
I'm not sure that such configurations previously worked properly in any case. I can add a breaking notice. |
Signed-off-by: Andrew Thornton <art27@cantab.net>
* giteaofficial/main: Prevent NPE whilst migrating if there is a team request review (go-gitea#19855) [skip ci] Updated translations via Crowdin Add support for rendering terminal output with colors (go-gitea#19497) Fix viewed images not loading in a PR (go-gitea#19919) Remove out-dated comments (go-gitea#19921) Automatically render wiki TOC (go-gitea#19873) Improve wording on delete access token modal (go-gitea#19909) [skip ci] Updated translations via Crowdin Add breaking email restrictions checker in doctor (go-gitea#19903) Ensure minimum mirror interval is reported on settings page (go-gitea#19895) Improve UX on modal for deleting an access token (go-gitea#19894) update discord invite (go-gitea#19907) Only log non ErrNotExist errors in git.GetNote (go-gitea#19884) [skip ci] Updated translations via Crowdin Update frontend guideline (go-gitea#19901) Make AppDataPath absolute against the AppWorkPath if it is not (go-gitea#19815)
…tea#19815) * Make AppDataPath absolute against the AppWorkPath if it is not There are multiple repeated issues whereby a non-absolute provided APP_DATA_PATH causes strange issues. This PR simply absolutes the APP_DATA_PATH against the AppWorkPath if its not so. It also ensures that AppWorkPath is also always absolute. Ref go-gitea#19367 Signed-off-by: Andrew Thornton <art27@cantab.net> * Add logging Signed-off-by: Andrew Thornton <art27@cantab.net> * absolute workpath against pwd instead of app path first Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
There are multiple repeated issues whereby a non-absolute provided
APP_DATA_PATH causes strange issues.
This PR simply absolutes the APP_DATA_PATH against the AppWorkPath if
its not so. It also ensures that AppWorkPath is also always absolute.
Ref #19367
Signed-off-by: Andrew Thornton art27@cantab.net
Server administrators should be aware that both the work path and the data path are now made absolute.
This second change is a breaking change for administrators who had APP_DATA_PATH as a relative path and the work path was not the current PWD.
However, because of the multiple issues reported with non-absolute APP_DATA_PATHs we expect that this change will affect few people.