double slash in asset URLs

site: https://opalschool.org/

I'm seeing a lot of 403 errors on a site of mine, and I see javascript errors in google developer tools console that always show a double forward slash in different plugin urls:

Failed to load resource: the server responded with a status of 403 ()
https://opalschool.org/wp-content/plugins/wp-smush-pro//assets/shared-ui/wdev-ui.css?ver=1.0 Failed to load resource: the server responded with a status of 403 ()
load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils,plupload&ver=6c00de4……:9 JQMIGRATE: Migrate is installed, version 1.4.1
https://opalschool.org/wp-content/plugins/wp-smush-pro//assets/shared-ui/wdev-ui.js?ver=1.0 Failed to load resource: the server responded with a status of 403 ()
https://opalschool.org/wp-content/plugins/wp-smush-pro//assets/shared-ui/notice.css?ver=1.0 Failed to load resource: the server responded with a status of 403 ()

When I am viewing the admin page for Smush Pro I get the above errors, and the editing buttons are not available... this makes sense since the double slash is keeping some assets from loading. I've tested and removing the double slash before the assets/ folder reveals the files are there.

I see the same thing happen for some other plugins too (learndash), and I just installed WP Smush Pro on this site today. So I know the issue has been happening for a bit.

I have tried the following with no success:
- changing the .htaccess file
- re-saving permalinks
- turning off redirect related plugins
- searching the database for" //assets/" in links to try to change any that may have been written incorrectly but were lingering

I have a staging site copy of the live site that is a recent copy in the last few days, and it does not show the errors. I have tried comparing plugins on both sites and not found any causes. I may get further with this comparison, but haven't had that much time on it yet.

Any ideas welcome... Thanks!

  • Adam Czajczyk

    Hello jeff67,

    I hope you're well today and thank you for your question!

    I visited the site in question and I can't see any errors of that kind in console on front end but I guess that's because they are related to WP Smush Pro plugin and Learndash so I would only see them in back-end. Am I correct?

    Could you please grant me a support access to the site so I could take a closer look at it? To do this, please follow this guide:

    https://premium.wpmudev.org/manuals/wpmu-dev-dashboard-enabling-staff-login/

    Best regards,
    Adam

  • Adam Czajczyk

    Hello jeff67!

    Thank you for granting access. I checked the site and thanks to it I was able to confirm the same issue on my own setup.

    On my end the double slash in assets URLs doesn't cause any problems and it seems that in most cases that's not an issue but it may be a problem in some cases such as yours. Those double-slashes seem to be coming from the WP Smush Pro plugin and not to be caused by any conflict/theme.

    As you said, your staging site is working fine but I'm pretty sure that if you review source/console you will find that there are double-slashes as well but they just doesn't affect performance.

    That being said, I already reported this to plugin developers as a bug and hopefully they'll be able to fix that soon. I think the plugin itself is working fine and just UI is not as it should be but I'm sure this is an easy fix so please keep the plugin up to date.

    Thank you for reporting this!

    Best regards,
    Adam

  • jeff67

    THanks Adam-

    SO why do you think I see it happening with one other plugin (LearnDash)? In both plugin's case the extra forward slash happens before the assets folder in the URL - after plugins/plugin_name//assets:

    https://opalschool.org/wp-content/plugins/sfwd-lms//assets/js/sfwd_module.min.js?ver=2.2.1.2 403 ()

    I thouhgt it would be some redirect plugin, but so far it seems limited to the two plugins, when viewed in the admin.

    THe site has had different 404 errors and some timeout issues, but they seem to be not related or at least have other causes.

  • Adam Czajczyk

    Hello jeff67!

    It would seem that the LearnDash contains similar "glitch". I'm not saying "bug" but rather "glitch" because it's most likely a simple "mistake" that's caused by an additional slash put somwhere in a code by accident or - even more likely - left there after replacing function with another one.

    This shouldn't cause any significant issues in 9 cases out of 10 but as we see here it is interfering sometimes. As I mentioned before, I already reported this to the developers and for WP Smush Pro we would be able to fix it. As for LearnDash you probably would wan't to turn to its developers.

    As for that slash being added by other plugin. The location of it makes it highly unlikely to be inserted by 3rd-party code. Furthermore, I tested it on a "default" WP setup with Twenty Sixteen theme and no other plugins active and was also able to see those double-slashes (though they did not have any affect on my site on my server).

    Having said that, I hope our devs will be able to deal with it shortly and in that case it would also confirm that LearnDash devs should review their code as well :slight_smile:

    Best regards,
    Adam

  • jeff67

    Thanks Adam-

    The thing that bugs me is that, as far as I know after working on websites for years, is that this url:

    something.com/folder/index.htm

    is different than:

    something.com/folder//index.htm

    So I can't see it being the case that if "something.com/folder/index.htm" is the path to a file then "something.com/folder//index.htm" should not work. So I think it should either work or not.

    I have a gut suspicion that using Hummingbird or another code minification plugin would alter something like this possibly, especially if there was a stutter in the writing of a file url. That's just a wild guess, but it is also the only other recent new thing I did on this site.

    Whatever the cause, I think the case that "something.com/folder//index.htm" works would be unlikely. On my staging copy I see "something.com/folder/index.htm" and it works, because that's where the file is.

  • Predrag Dubajic

    Hi Jeff,

    Minification should be causing such issues and as Adam already mentioned this seems to be affecting only certain installations.

    Could you try accessing your WP installation via FTP, navigate to /wp-content/plugins/wp-smush-pro/lib/ folder and edit class-wp-smush-admin.php
    Go to line 1696 where you should see this code:
    WDEV_Plugin_Ui::load( WP_SMUSH_URL . '/assets/shared-ui/', false );

    Remove the slash before assets and save the changes.

    See if WP Smush panel is working fine after that.

    Best regards,
    Predrag

  • Dimitris

    Hey there jeff67,

    hope you're doing good and don't mind chiming in! :slight_smile:

    Did you mean to say that "Minification should be causing such issues" or did you mean it could or could not?

    I believe Predrag meant that HummingBird could be causing this kind of issue as it relies on how assets are being loaded by each theme and plugin in first place.

    Either way that fixed the issue with the Smush Pro admin settings buttons not appearing.
    I'll apply the same logic to the LearnDash assets folder, and any others I see.

    I'm glad this hard fix made the trick for you. Our dev team is already notified about this fix, we're just waiting for them to push it into the next release.
    Kind of same glitch should be somewhere in LearnDash plugin too, feel free to ping its developers as you may lose any changes you've made in future updates. :wink:

    Kind regards,
    Dimitris

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.