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

passwords with spaces seem to fail? #4200

Closed
2 of 7 tasks
internalfx opened this issue Jun 9, 2018 · 3 comments · Fixed by #4275
Closed
2 of 7 tasks

passwords with spaces seem to fail? #4200

internalfx opened this issue Jun 9, 2018 · 3 comments · Fixed by #4275
Labels
Milestone

Comments

@internalfx
Copy link

  • Gitea version (or commit ref): 1.4.2
  • Git version:
  • Operating system: Ubuntu 18.04
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

If your postgres password contains a space, gitea will not install.

Screenshots

image

@lunny lunny added the type/bug label Jun 10, 2018
@bkcsoft
Copy link
Member

bkcsoft commented Jun 15, 2018

gitea/models/models.go

Lines 216 to 223 in 85414d8

case "postgres":
host, port := parsePostgreSQLHostPort(DbCfg.Host)
if host[0] == '/' { // looks like a unix socket
connStr = fmt.Sprintf("postgres://%s:%s@:%s/%s%ssslmode=%s&host=%s",
url.QueryEscape(DbCfg.User), url.QueryEscape(DbCfg.Passwd), port, DbCfg.Name, Param, DbCfg.SSLMode, host)
} else {
connStr = fmt.Sprintf("postgres://%s:%s@%s:%s/%s%ssslmode=%s",
url.QueryEscape(DbCfg.User), url.QueryEscape(DbCfg.Passwd), host, port, DbCfg.Name, Param, DbCfg.SSLMode)

QueryEscape should be PathEscape 🙂

@lunny
Copy link
Member

lunny commented Jun 19, 2018

@bkcsoft could you send a PR to fix that?

@techknowlogick
Copy link
Member

@lunny / @bkcsoft I've just sent a PR for this at #4275 Please review.

@lunny lunny added this to the 1.5.0 milestone Jun 19, 2018
lafriks pushed a commit that referenced this issue Jun 20, 2018
* Change parsing of postgresql settings

Fix #4200

* Add copyright

* update postgresql connection string

* add tests
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants