Closed vikulin closed 1 month ago
I'm leaning towards just adding the workaround like what's mentioned in the SO question to the docs. Probably something like a :host
+ host: "[::1]:8080"
parameter - this also works for things like foo.com:1234
. Given how rarely those variants are used in practice, I don't see it as worth the effort to support, especially when the workaround isn't all that complicated.
I'm leaning towards just adding the workaround like what's mentioned in the SO question to the docs. Probably something like a
:host
+host: "[::1]:8080"
parameter - this also works for things likefoo.com:1234
. Given how rarely those variants are used in practice, I don't see it as worth the effort to support, especially when the workaround isn't all that complicated.
@isiahmeadows , could you please be more specific in terms of m.request code examples how to do such workaround? If you suggest to change the m.request usage it would require more efforts in production code development. F e I counted flarum uses it 16 times:
root@ubuntu:/var/www/html/flarum# grep -o m.request . -R
./vendor/laminas/laminas-diactoros/CHANGELOG.md:m request
./vendor/laminas/laminas-diactoros/src/RequestTrait.php:m request
./vendor/middlewares/request-handler/README.md:m request
./vendor/middlewares/request-handler/src/RequestHandler.php:m request
./vendor/flarum/core/js/dist/forum.js:m.request
./vendor/flarum/core/js/dist/forum.js.map:m.request
./vendor/flarum/core/js/dist/forum.js.map:m.request
./vendor/flarum/core/js/dist/admin.js:m.request
./vendor/flarum/core/js/dist/admin.js.map:m.request
./vendor/flarum/core/js/dist/admin.js.map:m.request
./vendor/flarum/core/js/src/common/Application.js:m.request
./vendor/psr/http-message/src/RequestInterface.php:m request
./public/assets/forum-78abc0f0.js:m.request
./public/assets/forum-78abc0f0.js.map:m.request
./public/assets/forum-78abc0f0.js.map:m.request
./public/assets/admin-48c4593e.js.map:m.request
./public/assets/admin-48c4593e.js.map:m.request
./public/assets/admin-48c4593e.js:m.request
@vikulin I'm suggesting something like this:
m.request("http://:host/some/path", {
params: {host: "[202::a6a1:990a:cd27:4d9e:79]:8080"},
// ...
})
Shouldn't be too difficult to patch.
Note: I strongly recommend you move origin-relative URLs like /some/path
for these use cases as IP addresses really aren't that stable in practice, and you can much more easily move it around to other IPs if needed (you can avoid the need for source changes with it)f.
Bug Report
Current Behavior IPv6 URL causes "Error
Template parameter names *must* be separated
" error in m.request receiving IPv6 with [ ] symbols in URL. It can happen when flarum forum is installed using IPv6 host and it being used in URL. As result all clicks are throwing the same error in red box: "Oops! Something went wrong. Please reload the page and try again."Steps to Reproduce
Expected Behavior All activities should complete
Screenshots
Environment
Possible Solution There is an article with the clear explanation for a possible solution: https://stackoverflow.com/questions/63968329/error-template-parameter-names-must-be-separated
Additional Context More detailed error stack: