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

fix: support space in file name #446

Merged
merged 2 commits into from
May 6, 2024
Merged

fix: support space in file name #446

merged 2 commits into from
May 6, 2024

Conversation

MystiPanda
Copy link
Contributor

According to this issue comment, GitHub will rename the asset, which causes the name-based check to fail for file names containing spaces. We can change the file name to the same as GitHub before checking to solve this problem.

@@ -149,7 +149,7 @@ export const upload = async (
const [owner, repo] = config.github_repository.split("/");
const { name, size, mime, data: body } = asset(path);
const currentAsset = currentAssets.find(
({ name: currentName }) => currentName == name
({ name: currentName }) => currentName == name.replace(' ','.')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

according to the notes listed here we may want to expand this to include other characters but I'm okay with this as is for now.

The GitHub docs don't provide a non ambiguous list of characters that it transforms to periods. The best I could do is manually upload release asses with files that contain a wide variety of characters to learn from example

@softprops
Copy link
Owner

thanks for looking into this @MystiPanda. nice catch

@softprops softprops merged commit 998623f into softprops:master May 6, 2024
1 check failed
@MystiPanda
Copy link
Contributor Author

Yes, I noticed what the documentation said, I initially wanted to use a regex to match all the special characters the documentation said, but I didn't find this character list in the documentation, so I just replace space which is most common.

@MystiPanda
Copy link
Contributor Author

I think I've got something here. It seems that all characters except letters, numbers and @ - _ + are not supported, and consecutive unsupported characters will be replaced with a ., so simple space replacement may have problems, If a txt file is named with unsupported characters except for the extension, GitHub will rename it to default.txt

@softprops
Copy link
Owner

thanks. we can expand this list as we go. just a heads up, your changes have been incorporated into the v2 which now includes these changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants