You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sillyguodong 51ab495198
escape filename when assemble URL (#22850)
Fixes: #22843 

### Cause:

affdd40296/services/repository/files/content.go (L161)

Previously, we did not escape the **"%"** that might be in "treePath"
when call "url.parse()".


![image](https://user-images.githubusercontent.com/33891828/218066318-5a909e50-2a17-46e6-b32f-684b2aa4b91f.png)

This function will check whether "%" is the beginning of an escape
character. Obviously, the "%" in the example (hello%mother.txt) is not
that. So, the function will return a error.

### Solution:
We can escape "treePath" by call "url.PathEscape()" function firstly.

### Screenshot:

![image](https://user-images.githubusercontent.com/33891828/218069781-1a030f8b-18d0-4804-b0f8-73997849ef43.png)

---------

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Andrew Thornton <art27@cantab.net>
1 year ago
..
LICENSE Git LFS support v2 (#122) 8 years ago
client.go Implement FSFE REUSE for golang files (#21840) 2 years ago
client_test.go Implement FSFE REUSE for golang files (#21840) 2 years ago
content_store.go Implement FSFE REUSE for golang files (#21840) 2 years ago
endpoint.go escape filename when assemble URL (#22850) 1 year ago
endpoint_test.go Implement FSFE REUSE for golang files (#21840) 2 years ago
filesystem_client.go Implement FSFE REUSE for golang files (#21840) 2 years ago
http_client.go Implement FSFE REUSE for golang files (#21840) 2 years ago
http_client_test.go Implement FSFE REUSE for golang files (#21840) 2 years ago
pointer.go Implement FSFE REUSE for golang files (#21840) 2 years ago
pointer_scanner_gogit.go Implement FSFE REUSE for golang files (#21840) 2 years ago
pointer_scanner_nogogit.go Implement FSFE REUSE for golang files (#21840) 2 years ago
pointer_test.go Implement FSFE REUSE for golang files (#21840) 2 years ago
shared.go Implement FSFE REUSE for golang files (#21840) 2 years ago
transferadapter.go Implement FSFE REUSE for golang files (#21840) 2 years ago
transferadapter_test.go Implement FSFE REUSE for golang files (#21840) 2 years ago