asset() function doubling up on the forum URL prefix
When I try to upload a non-image file:
I cleared my cache, I tried deactivating/reactivating Advanced editor. The call to asset() is happening in /plugins/editor/class.editor.plugin.php.
The reason I noticed this, is that the URL it was calling was /plugins/FileUpload/images/file.png. So the little file icon was missing for non-image files. Tried to fix it, and this is what happens.
I'm having another issue with advanced editor file uploads as well, in case you saw that error message (the 'GetComputedStyle' one). Images will upload, but they are attached instead of being inserted into the message. Similarly to another issue that was reported here, which was fixed, but a slightly different error message. I'm trying to hunt down the issue there.
Comments
Weirdly, this only happens with an .ico file (so far). I've tried .txt and .xlsx files and they work fine.
???
The good news, for anyone who's following along as I talk to myself, is that I've figured out what's wrong. The bad news is that I'm not exactly sure if I've fixed it properly.
Editor v 1.7.2. class.editor.plugin.php:1562. The code here calls asset() on a URL, then feeds the result to redirect(). Both asset() and redirect() call GDN::Request->Url() to prepend the forum prefix.
My solution is to change
$url = asset('/plugins/editor/file.png');
to
$url = '/plugins/editor/file.png';
Seem correct to anybody?
Also, the first error is still there. I'm having a hell of a time tracking down the JS that's responsible for this. Any help would be greatly appreciated - you can see for yourself at
http://trstriathlon.com/TRSForum/discussion/1972/ask-a-random-triathlete-bike-transport-and-homestay-etiquette#latest
Actually it may be better to do
$url=Url('plugins/editor/file.png');
If your forum is not in the root, this has helped me to change things as the example above to avoid 404 or doubled urls
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌