nunocoracao / blowfish

Personal Website & Blog Theme for Hugo
https://blowfish.page
MIT License
1.53k stars 420 forks source link

Fix broken hugo module on v2.79.0 #1838

Open wtchangdm opened 1 week ago

wtchangdm commented 1 week ago

This PR fixes #1835.

We could have used

- var dir = usersFolderPath + users[i].title.replaceAll("/", "-");
+ var dir = usersFolderPath + users[i].title.replaceAll("/", "-")
+                                            .replaceAll(".", "-")
+                                            .replaceAll("’", "-");

but there are too many symbols to handle.

Use url for paths should be unique enough.

deining commented 1 week ago

This PR fixes #1835.

For me, it doesn't:

git clone git@github.com:wtchangdm/blowfish.git -b fix-hugo-module blowfish_wtchangdm
cd blowfish_wtchangdm/exampleSite
hugo mod init wtchangdm
go get github.com/wtchangdm/blowfish/v2@b943698178abe3b8eaa14020bc405219cd3d51b4
go: downloading github.com/wtchangdm/blowfish/v2 v2.79.100-0.20241108212210-b943698178ab
go: github.com/wtchangdm/blowfish/v2@b943698178abe3b8eaa14020bc405219cd3d51b4: create zip: exampleSite/content/users/Handbook on Teaching Empirical Software Engineering: Online Materials/feature.jpg: malformed file path "exampleSite/content/users/Handbook on Teaching Empirical Software Engineering: Online Materials/feature.jpg": invalid char ':'
exampleSite/content/users/Handbook on Teaching Empirical Software Engineering: Online Materials/index.it.md: malformed file path "exampleSite/content/users/Handbook on Teaching Empirical Software Engineering: Online Materials/index.it.md": invalid char ':'
exampleSite/content/users/Handbook on Teaching Empirical Software Engineering: Online Materials/index.ja.md: malformed file path "exampleSite/content/users/Handbook on Teaching Empirical Software Engineering: Online Materials/index.ja.md": invalid char ':'
exampleSite/content/users/Handbook on Teaching Empirical Software Engineering: Online Materials/index.md: malformed file path "exampleSite/content/users/Handbook on Teaching Empirical Software Engineering: Online Materials/index.md": invalid char ':'
exampleSite/content/users/Handbook on Teaching Empirical Software Engineering: Online Materials/index.zh-cn.md: malformed file path "exampleSite/content/users/Handbook on Teaching Empirical Software Engineering: Online Materials/index.zh-cn.md": invalid char ':'
exampleSite/content/users/Xeonzilla’s Note/feature.jpg: malformed file path "exampleSite/content/users/Xeonzilla’s Note/feature.jpg": invalid char '’'
exampleSite/content/users/Xeonzilla’s Note/index.it.md: malformed file path "exampleSite/content/users/Xeonzilla’s Note/index.it.md": invalid char '’'
exampleSite/content/users/Xeonzilla’s Note/index.ja.md: malformed file path "exampleSite/content/users/Xeonzilla’s Note/index.ja.md": invalid char '’'
exampleSite/content/users/Xeonzilla’s Note/index.md: malformed file path "exampleSite/content/users/Xeonzilla’s Note/index.md": invalid char '’'
exampleSite/content/users/Xeonzilla’s Note/index.zh-cn.md: malformed file path "exampleSite/content/users/Xeonzilla’s Note/index.zh-cn.md": invalid char '’'

Having a look at the log above, >I see that the error occurs while golang tries to build a zip-file from the repo. I think the only way to fix that issue is to remove the offending characters : and from the directory names.

wtchangdm commented 1 week ago

For me, it doesn't:

I believe this is the script that @nunocoracao manually run before release. The change included in this branch is only the script itself: https://github.com/wtchangdm/blowfish/compare/main...fix-hugo-module.

The effect you wanted to see (i.e., after running the script) is: https://github.com/wtchangdm/blowfish/compare/main...after-script-run.

If you wanted to test the hugo module, you can change module.toml to:

[[imports]]
path = "github.com/wtchangdm/blowfish/v2"

and then this version in go.mod:

require github.com/wtchangdm/blowfish/v2 v2.79.9999999999 // indirect