Can not edit/delete a file when its name starts with spaces #8316

Closed
opened 2025-11-02 08:02:03 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @wxiaoguang on GitHub (Jan 4, 2022).

  1. There are two cleanUploadFileName functions
  2. The spaces in filenames are trimmed
  3. If a file name starts with space eg: decode(%20a.txt), then it can not be edited/deleted from the web UI

@zeripath do you have any idea about why the spaces are trimmed? this change was introduced by #5702

ff2fd08228/routers/web/repo/editor.go (L733-L743)

719bddcd76/services/repository/files/file.go (L129-L140)

image

Originally created by @wxiaoguang on GitHub (Jan 4, 2022). 1. There are two `cleanUploadFileName` functions 2. The spaces in filenames are trimmed 3. If a file name starts with space eg: decode(`%20a.txt`), then it can not be edited/deleted from the web UI @zeripath do you have any idea about why the spaces are trimmed? this change was introduced by #5702 https://github.com/go-gitea/gitea/blob/ff2fd08228dd6323ac4a1cbd2f37f8ae15733eab/routers/web/repo/editor.go#L733-L743 https://github.com/go-gitea/gitea/blob/719bddcd76610a63dadc8555760072957a11cf30/services/repository/files/file.go#L129-L140 ![image](https://user-images.githubusercontent.com/2114189/148034326-78379988-6106-4011-bd4a-6e9c74583b8e.png)
GiteaMirror added the type/bug label 2025-11-02 08:02:03 -06:00
Author
Owner

@zeripath commented on GitHub (Jan 17, 2022):

I think the trim can safely be dropped

@zeripath commented on GitHub (Jan 17, 2022): I think the trim can safely be dropped
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#8316