13340: Enhance regex to match non quoted locators
authorLucas Di Pentima <ldipentima@veritasgenetics.com>
Thu, 16 Aug 2018 21:40:14 +0000 (18:40 -0300)
committerLucas Di Pentima <ldipentima@veritasgenetics.com>
Thu, 16 Aug 2018 21:40:14 +0000 (18:40 -0300)
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima@veritasgenetics.com>

apps/workbench/app/helpers/application_helper.rb

index 9562e18a3f9b8b16491e56d9d21fe0d315784d32..2b48d74b20c09d407edb11d36bdb06d7152bdaa8 100644 (file)
@@ -673,7 +673,7 @@ module ApplicationHelper
   end
 
   # Keep locators are expected to be of the form \"...<pdh/file_path>\"
-  JSON_KEEP_LOCATOR_REGEXP = /[\'\"][^\'\"]*?([0-9a-f]{32}\+\d+[^\'\"]*?)[\'\"]/
+  JSON_KEEP_LOCATOR_REGEXP = /([0-9a-f]{32}\+\d+[^'"]*?)(?=['"]|\z|$)/
   def keep_locator_in_json str
     # Return a list of all matches
     str.scan(JSON_KEEP_LOCATOR_REGEXP).flatten