Skip to content

Commit

Permalink
Alter regex to allow apostrophes in document titles
Browse files Browse the repository at this point in the history
When parsing the content of pig content packages, the regex to look for the
following pattern: href="/documents/%slug%">%Document title% would break if the
document title included a '. This fix now stops the capture at '> OR ">
  • Loading branch information
Greg Woodcock committed Jun 13, 2016
1 parent f9f6bfd commit e2e30f6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/trough/pig/hooks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def determine_text_change(key, content_chunk)
def find_documents(value)
# Find all links to /documents/:slug and return the slugs
return [] if value.nil?
value.scan(/href=\S*\/documents\/(\S+[^\\])\\?['"]/).flatten
value.scan(/href=\S*\/documents\/(\S+[^\\])\\?['"]>/).flatten
end

def unlink_document_usages
Expand Down

0 comments on commit e2e30f6

Please sign in to comment.