]> source.dussan.org Git - gitea.git/commit
Fix redirect when using lowercase reponame (#18775) (#18902)
authorOtto Richter (fnetX) <git@fralix.ovh>
Sat, 26 Feb 2022 00:16:22 +0000 (01:16 +0100)
committerGitHub <noreply@github.com>
Sat, 26 Feb 2022 00:16:22 +0000 (08:16 +0800)
commit6039138323ce037f0a499aef8a968d374e2a9edc
tree245883f35600d95976cae1b3a575865d318cd8c1
parenteb43e7378574a9542af13454b1b959159b582c57
Fix redirect when using lowercase reponame (#18775) (#18902)

* Previously,  `GET {username}/{reponame}/raw///file-path` (the middle two slashes are blank to get the default branch) when the repo name has uppercase letters, e.g., https://try.gitea.io/AbdulrhmnGhanem/CH330_Hardware, using a lowercase version of the name redirected to the correct URL
* In other words both
   * `GET https://try.gitea.io/AbdulrhmnGhanem/CH330_Hardware/raw///images/back.png`
   * `GET https://try.gitea.io/AbdulrhmnGhanem/ch330_hardware/raw///images/back.png`
were redirecting to ` GET https://try.gitea.io/AbdulrhmnGhanem/CH330_Hardware/raw/branch/master/images/back.png`
This isn't the case after  #17551. Specifically because of this [line](https://github.com/zeripath/gitea/blob/cbd5eecd148dfca5fcb1a3da469e491a84f6b32b/modules/context/repo.go#L860).

Co-authored-by: Ghanem <37152329+AbdulrhmnGhanem@users.noreply.github.com>
modules/context/repo.go