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

Documentation should be more explicit, that things like LOCAL_ROOT_URL require a trailing slash #19166

Closed
p-kraszewski opened this issue Mar 22, 2022 · 3 comments · Fixed by #19171
Labels
type/feature Completely new functionality. Can only be merged if feature freeze is not active. type/proposal The new feature has not been accepted yet but needs to be discussed first.
Milestone

Comments

@p-kraszewski
Copy link

Feature Description

Hey y'all!

Thank you for an excellent project!

However, I've spent most of the today chasing, why any access via ssh:// ended with uninformative "Internal error". Only after enabling dev mode and trace logging level it appeared gitea serv connected back to the daemon with wrong path.

DOC/FAQ should be much more explicit, that LOCAL_ROOT_URL should be a path to gitea web interface reachable from localhost and must have a trailing slash (this may be the case of you concatenating path elements manually instead of using path.Join(...))

Screenshots

No response

@p-kraszewski p-kraszewski added type/feature Completely new functionality. Can only be merged if feature freeze is not active. type/proposal The new feature has not been accepted yet but needs to be discussed first. labels Mar 22, 2022
@silverwind
Copy link
Member

silverwind commented Mar 22, 2022

I think we better just append a absent slash to the parsed variable if it's really crucial.

@p-kraszewski
Copy link
Author

p-kraszewski commented Mar 22, 2022

It is crucial, as without it the SSH helper performs requests on www.mydomain.comapi/....

if !strings.HasSuffix(setting.LocalURL,`/`){
   setting.LocalURL=setting.LocalURL+`/`
}

Another way is to avoid things like

reqURL := setting.LocalURL + "api/internal/mail/send"

and replace it with

// I'm not sure of the performance impact
reqURL := path.Join(setting.LocalURL,"api/internal/mail/send")

or

// Double slash would do no harm and relative paths aren't valid here.
reqURL := setting.LocalURL + "/api/internal/mail/send"

However, your way is the least error-prone as of now (do it once, during the parsing of the config file)

zeripath added a commit to zeripath/gitea that referenced this issue Mar 22, 2022
@zeripath zeripath changed the title Documentation shall be more explicit, that things like LOCAL_ROOT_URL require a trailing slash Documentation should be more explicit, that things like LOCAL_ROOT_URL require a trailing slash Mar 22, 2022
zeripath added a commit that referenced this issue Mar 22, 2022
zeripath added a commit to zeripath/gitea that referenced this issue Mar 22, 2022
wxiaoguang pushed a commit that referenced this issue Mar 23, 2022
@p-kraszewski
Copy link
Author

Wow, that escalated quickly...

@zeripath zeripath added this to the 1.16.5 milestone Mar 23, 2022
Chianina pushed a commit to Chianina/gitea that referenced this issue Mar 28, 2022
@go-gitea go-gitea locked and limited conversation to collaborators Apr 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type/feature Completely new functionality. Can only be merged if feature freeze is not active. type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants