Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

javascript_include_tag shouldn't append a ".js" onto external urls

#1664

the problem


javascript_include_tag("http://www.google.com/jsapi")
=> %(<script type="text/javascript" src="http://www.google.com/jsapi.js"></script>)

but that url isn't valid.

If we've specified an external url, then we should also have specified the extension if there is one.

All the tests seem to pass, and I don't seem to have broken the external asset-host functionality.

Reported by MatthewRudy · December 29th, 2008 @ 05:52 PM

State: resolved
Milestone: 2.x
Assigned to: Pratik Pratik
Importance: none

Activity

  1. MatthewRudy
    MatthewRudy

    a recent commit changed the underlying code in asset_tag helper.

    as such this patch no longer works

    the offending code is;

    
    if ext && (File.extname(source).blank? || File.exist?(File.join(ASSETS_DIR, dir, "#{source}.#{ext}")))
      source += ".#{ext}"
    end
    

    I think it should be changed to exclude;

    
    source += ".#{ext}" unless source =~ %r{^[-a-z]+://}
    

    however I need to dry up all these calls to %r{^[-a-z]+://}

    something for the morning

    January 5th, 2009 @ 02:11 AM

  2. Pratik
    Pratik
    • Assigned user set to Pratik
    • State changed from new to incomplete

    Patch doesn't apply anymore ( of course, it's been months :( ). But ok, I'll try to apply as soon as there's a new patch.

    Thanks !

    March 8th, 2009 @ 12:25 AM

  3. CancelProfileIsBroken
    CancelProfileIsBroken
    • Tag changed from actionpack, assets, asset_tag_helper, javascript to actionpack, assets, asset_tag_helper, bugmash, javascript

    August 5th, 2009 @ 03:15 PM

  4. MatthewRudy
    MatthewRudy

    this just bit me again yesterday.

    I should build a patch.

    August 5th, 2009 @ 03:18 PM

  5. MatthewRudy
  6. Repository
    Repository
    • State changed from incomplete to resolved

    (from [64268a0b06d32567c6e88b7293f332b79e10414b]) Make sure javascript_include_tag/stylesheet_link_tag does not append ".js" or ".css" onto external urls [#1664 javascript_include_tag shouldn't append a ".js" onto external urls state:resolved]

    Signed-off-by: Pratik Naik pratiknaik@gmail.com
    http://github.com/rails/rails/commit/64268a0b06d32567c6e88b7293f332...

    August 5th, 2009 @ 05:16 PM

  7. CancelProfileIsBroken
    CancelProfileIsBroken
    • Tag changed from actionpack, assets, asset_tag_helper, bugmash, javascript to actionpack, assets, asset_tag_helper, javascript

    August 5th, 2009 @ 05:20 PM