Force encoding and stip filename in Theme::parse_urls
This commit is contained in:
parent
9101a2921e
commit
25355e9c7f
|
@ -6,14 +6,14 @@ class Theme < Stylesheet
|
|||
before_save :set_name
|
||||
|
||||
def parse_urls
|
||||
orig_content = content = self.file.read
|
||||
orig_content = content = self.file.read.force_encoding("UTF-8")
|
||||
self.remove_file!
|
||||
self.remove_file_orig!
|
||||
names = []
|
||||
images = self.design.images
|
||||
content.scan(/(?<=url\()(.*?)(?=\))/){
|
||||
css_name = $1
|
||||
name = File.basename(css_name).gsub(/[\\\"]/, '')
|
||||
name = File.basename(css_name).gsub(/[\\\"]/, '').strip
|
||||
file_name = images.detect{ |i| i.file_filename.eql?(name) }.file_url rescue nil
|
||||
names << [css_name, file_name]
|
||||
}
|
||||
|
|
Reference in New Issue