Skip to content

RAILS_RELATIVE_URL_ROOT=.. passed into rake assets:precompile results in path ../../assets/foo rather than ../assets/foo #505

Open
@david-pink

Description

@david-pink

I work on a project which runs rake assets:precompile during a docker build stage, rather than at runtime. Since we don't know the URL root at buildtime, we pass in RAILS_RELATIVE_URL_ROOT=.. and this successfully builds our assets and makes them available regardless of the URL root passed into the container.

However, when we upgraded sprockets-rails from 3.2.2 to 3.3.0, this no longer works as the generated path for the assets is ../../assets/foo rather than ../assets/foo as it was before. The result is we can access the assets when no URL root is provided, but when one is provided we can't.

I believe the logic that broke this was introduced in pull request 476. Could I request a patch 3.x.y fix for this please? I realise this may not be a supported use case, hence why I haven't seen any evidence that anyone else has hit it, but it's blocking us from updating to a later sprockets-rails version, so a fix would be much appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions