lib/devcenter/helpers.rb in devcenter-0.0.5 vs lib/devcenter/helpers.rb in devcenter-0.0.6
- old
+ new
@@ -21,10 +21,11 @@
url.match(/\A#{escaped_base_url}\/articles\/.+/)
true
end
def slug_from_article_url(url)
- url.split('/articles/').last
+ return nil unless url
+ url.split('/articles/').last.split('?').first.split('#').first
end
def md_file_path(slug)
File.expand_path("#{slug}.md")
end
\ No newline at end of file