go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
43.82k stars 5.38k forks source link

Create ZIP archive with problematic file names #31613

Open KazzmanK opened 1 month ago

KazzmanK commented 1 month ago

Description

We have an IOS project, where some files (under Mac) have non usual symbols file names. I`m not sure, but they are something like space, that is translated to question mark in Git. While interacting with repository Mac<->Git is Okay, but creating Zip archive is not, because Gitea is windows-hosted.

Here is a log line

2024/07/11 11:53:52 ...archiver/archiver.go:285:func1() [E] Archive &{95  zip b3c1f2fc6ec42688c0c6cacc90abf724b2a61bb7} failed: 
unable to write archive: exit status 255 - error: invalid path 'MyApp/TableViewExt/String?ValueVerifier.swift'

Probably, Zip archive is created not on-the-fly, but by writing repo to temp folder, that can not be done.

Is there something what can be improved here?

Gitea Version

1.22.1

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

https://gist.github.com/KazzmanK/c494d60d31a48a29034fc888f3890406

Screenshots

No response

Git Version

2.44.0

Operating System

win

How are you running Gitea?

Windows service

Database

SQLite

lunny commented 1 month ago

What's the file path on the git system?

KazzmanK commented 1 month ago
myapp.git>git ls-tree --full-tree -r HEAD | find "ValueVerifier"
100644 blob 3eb874108eabeac07d1114c7bb72b339de660599    "MyApp/TableViewExt/String\020ValueVerifier.swift"

Repo location D:\Apps\Gitea\data\gitea-repositories

KazzmanK commented 1 month ago

I`v tried to create a temp branch and remove this file, but still HTTP 500

An error occurred:

DeleteRepoFile, SetDefaultIndex: exit status 128 - error: invalid path 'MyApp/TableViewExt/String?ValueVerifier.swift'

It can turn out, that in general Git itself cannot deal with such files.

Only on another Mac I was able to checkout repo, create branch, rename file, push, and now I have branch on Gitea without buggy file.

Trying to locally (on server) remove it git filter-branch --index-filter "git rm --cached --ignore-unmatch MyApp/TableViewExt/String\020ValueVerifier.swift" -- --all resulted in same error: invalid path 'MyApp/TVE Editing/String?ValueVerifier.swift'