Closed njzjz closed 7 months ago
The char ] should be escaped into %5D Same for the [ which should be %5B
There might be another way to escape those....
According to RFC3986, square brackets is acceptable for URI. I'm not sure if hexo should make changes.
WHATWG URL API doesn't escape square brackets, but encodeURI() does.
RFC3986 says
A host identified by an Internet Protocol literal address, version 6 [RFC3513] or later, is distinguished by enclosing the IP literal within square brackets ("[" and "]"). This is the only place where square bracket characters are allowed in the URI syntax.
To my understanding, it only allows squared brackets used in a host like http://[2607:f8b0:4005:802::1007]/
.
Other usage is disallowed.
The char ] should be escaped into %5D Same for the [ which should be %5B
As a workaround, I manually replace [
and ]
in the links with %5B
and %5D
, respectively, and it works. However, the link in the source code is hard to read.
GitHub renders it as:
The actual link in the source code is: https://bf.njzjz.win/ecnuchemistry/%E5%88%86%E6%9E%90%E5%8C%96%E5%AD%A6%E4%B8%8E%E5%88%86%E6%9E%90%E6%8A%80%E6%9C%AF(I)/%E8%AF%BE%E4%BB%B6-2-2%20%E7%AC%AC%E4%BA%8C%E7%AB%A0%20%E5%88%86%E6%9E%90%E6%95%B0%E6%8D%AE%E7%9A%84%E5%A4%84%E7%90%86%E5%92%8C%E8%B4%A8%E9%87%8F%E4%BF%9D%E8%AF%81%20%5B%E5%85%BC%E5%AE%B9%E6%A8%A1%E5%BC%8F%5D.pdf
However, hexo-renderer-marked renders the URL as:
https://bb.njzjz.win/file/jinzhe/ecnuchemistry/%E5%88%86%E6%9E%90%E5%8C%96%E5%AD%A6%E4%B8%8E%E5%88%86%E6%9E%90%E6%8A%80%E6%9C%AF(I)/%E8%AF%BE%E4%BB%B6-2-2%20%E7%AC%AC%E4%BA%8C%E7%AB%A0%20%E5%88%86%E6%9E%90%E6%95%B0%E6%8D%AE%E7%9A%84%E5%A4%84%E7%90%86%E5%92%8C%E8%B4%A8%E9%87%8F%E4%BF%9D%E8%AF%81%20[%E5%85%BC%E5%AE%B9%E6%A8%A1%E5%BC%8F].pdf
[]
are not escaped, causing a 404 error.