From d7ec8206223eaa7f0bece2e5486f66f516d59877 Mon Sep 17 00:00:00 2001 From: Daniel King Date: Wed, 31 Aug 2016 11:31:39 +0100 Subject: [PATCH] escape use of hyphen in slug regex --- app/models/trough/document.rb | 2 +- lib/trough/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/trough/document.rb b/app/models/trough/document.rb index 2b568c7..95398c9 100644 --- a/app/models/trough/document.rb +++ b/app/models/trough/document.rb @@ -60,7 +60,7 @@ def set_slug(fix_for_extensions=false) else filename = file_filename.split('.')[0...-1].join('.') end - escaped_name = filename ? filename.downcase.gsub(/[^0-9a-z-_. ]/, '').squish.gsub(' ', '-') : 'temporary' + escaped_name = filename ? filename.downcase.gsub(/[^0-9a-z\-_. ]/, '').squish.gsub(' ', '-') : 'temporary' temp_slug = escaped_name.dup suffix = 1 while Document.where(slug: temp_slug).present? diff --git a/lib/trough/version.rb b/lib/trough/version.rb index 53f0d2c..8f9d856 100644 --- a/lib/trough/version.rb +++ b/lib/trough/version.rb @@ -1,3 +1,3 @@ module Trough - VERSION = "1.0.1" + VERSION = "1.0.2" end