This project is archived and is in readonly mode.

#3245 ✓stale
niko

rewrite_asset_path should respect already existing query strings

Reported by niko | September 22nd, 2009 @ 10:45 AM

Fix:

  def rewrite_asset_path(source)
    asset_id = rails_asset_id(source)
    if asset_id.blank?
      source
    else
      source + "#{source.include?('?') ? '&' : '?'}#{asset_id}"
    end
  end

Comments and changes to this ticket

  • CancelProfileIsBroken

    CancelProfileIsBroken September 25th, 2009 @ 11:54 AM

    • Tag changed from 2.3.2, asset_tag_helper to 2.3.2, asset_tag_helper, bugmash
  • John Pignata

    John Pignata September 27th, 2009 @ 04:34 AM

    -1 - rewrite_asset_path is private and probably shouldn't be enhanced directly without /good/ reason. The one call to this method I see is from compute_public_path which seems to not call this method if the string is URL-like. What problem is this bug report trying to solve?

  • Mike Enriquez

    Mike Enriquez September 27th, 2009 @ 07:01 PM

    1. I agree with John. I can't think of a use for a dynamic asset that would need a query string. More info would be helpful.
  • niko

    niko September 27th, 2009 @ 07:16 PM

    We're using #compute_public_path for some downloadable assets, where the filename of the downloaded file must be different than the filename on the server. So the webpath looks like this:

    /resources/audio/af/A%20nice%20Song.mp3?filename=af12345.mpga

    Obviously we want the files served by our asset-servers.

    I would really like it if #compute_public_path as well as #compute_asset_host and #rewrite_asset_path were public.

  • Rizwan Reza

    Rizwan Reza February 12th, 2010 @ 12:46 PM

    • Tag changed from 2.3.2, asset_tag_helper, bugmash to 2.3.2, asset_tag_helper
  • Rohit Arondekar

    Rohit Arondekar February 2nd, 2011 @ 10:21 AM

    • State changed from “new” to “stale”
    • Importance changed from “” to “”

    Marking ticket as stale. If this is still an issue please leave a comment with suggested changes, creating a patch with tests, rebasing an existing patch or just confirming the issue on a latest release or master/branches.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Pages