Closed YDX-2147483647 closed 1 year ago
It looks like it was indeed the encoding of the URL that was causing the problem. I've added code to handle it; let me know if it's still a problem for you.
Thanks! It works now. :tada:
{"updated_scripts":["https://greasyfork.org/zh-CN/scripts/466252-bit-%E8%A1%A5%E8%B6%B3%E9%A1%B5%E9%9D%A2%E6%A0%87%E9%A2%98"],"updated_failed":[]}
Problem
I can't sync a file with non-ASCII name to GreasyFork with WebHook.
Update URL: https://github.com/YDX-2147483647/BIT-enhanced/raw/main/TamperMonkey/BIT-%E8%A1%A5%E8%B6%B3%E9%A1%B5%E9%9D%A2%E6%A0%87%E9%A2%98.user.js
The file name is not fully ASCII, so it's encoded in the URL.
GitHub WebHook's request:
"modified": ["TamperMonkey/BIT-补足页面标题.user.js"]
(This is
.commits[0].modified
. I can provide the full JSON if you want.)However when GitHub sends the list of modified files, it is not URL-encoded.
GreasyFork's response:
{"updated_scripts":[],"updated_failed":[]}
Therefore, GreasyFork finds nothing.
If I use an ASCII file name instead, it works.
"modified": ["TamperMonkey/BIT-rectify-pages-titles.user.user.js"]
{"updated_scripts":["https://greasyfork.org/zh-CN/scripts/378513-bilibili-cc%E5%AD%97%E5%B9%95%E5%8A%A9%E6%89%8B"],"updated_failed":[]}
Technical Reason
We use
info[:urls]
to identify scripts inapp/controllers/concerns/webhooks.rb
.https://github.com/JasonBarnabe/greasyfork/blob/2c3a26d4f9457f49fd123998b2958cec90f45160/app/controllers/concerns/webhooks.rb#L118
But we don't encode the filenames in
lib/github.rb
.https://github.com/JasonBarnabe/greasyfork/blob/2c3a26d4f9457f49fd123998b2958cec90f45160/lib/github.rb#L47-L55
Possible Fix
I guess this is identical to #380 (in Aug 2015).
It was fixed by changing …
… to …
Days passed, and the file was totally refactored… There's no
URI.escape
in today's repo.(This repo is 9 years old, thank you for maintaining GreasyFork!)