diff --git a/app/models/design/layout.rb b/app/models/design/layout.rb
index 729153df..c8436db6 100644
--- a/app/models/design/layout.rb
+++ b/app/models/design/layout.rb
@@ -29,9 +29,12 @@ class Layout < DesignFile
self.remove_file_orig!
names = []
images = self.design.images
- content.scan(/(?<=\)/){
- html_name = $1
- name = File.basename(html_name).gsub(/[\\\"]/, '').strip
+ html_name = nil
+ content.scan(/(?<=\)/){
+ $1.gsub(' ','').scan(/(?<=src=\")(.*?)(?=\")/){
+ html_name = $1
+ }
+ name = File.basename(html_name).gsub(/[\\\"]/, '')
file_name = images.detect{ |i| i.file_filename.eql?(name) }.file_url rescue nil
names << [html_name, file_name]
}
diff --git a/app/models/design/theme.rb b/app/models/design/theme.rb
index 612f4fbd..756b7e12 100644
--- a/app/models/design/theme.rb
+++ b/app/models/design/theme.rb
@@ -11,9 +11,9 @@ class Theme < Stylesheet
self.remove_file_orig!
names = []
images = self.design.images
- content.scan(/(?<=url\()(.*?)(?=\))/){
- css_name = $1
- name = File.basename(css_name).gsub(/[\\\"]/, '').strip
+ content.scan(/(?<=url)(.*?)(?=\))/){
+ css_name = $1.gsub(' ','').gsub('(','')
+ name = File.basename(css_name).gsub(/[\\\"]/, '')
file_name = images.detect{ |i| i.file_filename.eql?(name) }.file_url rescue nil
names << [css_name, file_name]
}