Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Calculator

0

118
Views
How to enable using css url function with loofah?

What I already tried:

Loofah::HTML5::WhiteList::ACCEPTABLE_CSS_FUNCTIONS.add 'url'
Loofah::HTML5::WhiteList::ACCEPTABLE_CSS_PROPERTIES.add 'background-image'

But

Rails::Html::WhiteListSanitizer.new.sanitize_css 'background-image: url(https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png);'

returns ""

Testing with rgb:

Rails::Html::WhiteListSanitizer.new.sanitize_css 'background-image: rgb(https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png);'

returns

'background-image:rgb(https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png);'

With Loofah::HTML5::Scrub.scrub_css I have the same results.

Lofah version : 2.13.0

Rails version : 6.1.4.4

Tested in Rails Console

10 months ago · Santiago Trujillo
1 answers
Answer question

0

I'm afraid it doesn't work because the url filter is hardcoded.

10 months ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post job Plans Our process Sales
Legal
Terms and conditions Privacy policy
© 2023 PeakU Inc. All Rights Reserved.