Wrong url returned by \Roots\asset() function

Hi there,
trying to get the url of an image from the public directory of my sage theme i get a wrong uri.
My environment is based on bedrock, sage and bud using laravel valet.

The method \Roots\asset(‘images/svg/logo-header.svg’) returns wrong path and uri.

I get this:


instead of this:


It seems the string “app/themes/themename/public” is repeated twice in the url.

Has Anyone experienced something similar?
Have you got any suggestion to resolve this?

Thank you


1 Like

i can confirm this happens in certain usecases

1 Like

Does the sole file name (\Roots\asset(‘logo-header.svg’)) result in the correct URL (at least as a workaround)?

1 Like

@strarsis Thank you for your reply!

As temporary workaround it works.
Using \Roots\asset(‘logo-header.svg’ I get this url:
without the repetition but the images folder is missing.
So the issue seems to be caused by subdirectories in asset folder.

1 Like

Which version of Sage and Bud are you on? It’s possible that you’re running into Bug: Images in resources/images go into public root directly · Issue #3071 · roots/sage · GitHub which was resolved in newer versions of Bud.

That issue also has a comment that shows how to work-around the bug without upgrading Bud.


Sage version is 10.1.7 and Bud version is 5.8.7.
I can’t figure how, but today after running up the project, the asset() method works as expected.
I think it could depends on the clearing of the cache but it is really strange because yesterday i ran wp acorn config:clear && wp acorn view:clear && wp acorn optimize:clear and after that it wasn’t still working.
Anyway now it’s working. Im’ really sorry for wasting your time.
I’ll study more on it trying to understand what happened. If I’ll found an explanation I’ll let you know.

Thank you