No release in over 3 years
Low commit activity in last 3 years
Sanitize SVG images after ActiveStorage upload
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 5.2
 Project Readme

ActiveStorageSvgSanitizer

A small library that sanitizes ActiveStorage SVG uploads by stripping any embedded script tags.

Installation

Add this line to your application's Gemfile:

gem 'active_storage_svg_sanitizer'

Usage

Simply including this gem will ensure your svg uploads are sanitized.

This libary uses ActiveJob to perform sanization tasks in the background.

Rendering SVG Images

If you'd like to render ActiveSorage svg images in your application, add an initializer that unregisters svg as a binary file type.

# config/initializers/active_storage.rb
ActiveStorage::Engine.config.active_storage.content_types_to_serve_as_binary.delete "image/svg+xml"

License

The gem is available as open source under the terms of the MIT License.