Created
March 14, 2012 11:13
-
-
Save lucagrulla/2035822 to your computer and use it in GitHub Desktop.
sanitize Windows file url for the web
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
image_path = "\images\foo\myimage.png" | |
image_path = image_path.dump.gsub(/\\\\/,"/").gsub("\"", "") | |
#total crazyness to cope with windows cut&paste url with backslashes instead of forward slashes:we convert to / just to avoid troubles... | |
#cover scenarios where Windows users find where a file is using windows explorer and copy the location from there(therefore with backslashes) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment