From 5846f598ac64f42e827d3d2489915c8db1ff4c54 Mon Sep 17 00:00:00 2001 From: Prateek Saxena Date: Tue, 19 Apr 2016 12:43:08 +0530 Subject: [PATCH] Fix URL pattern problem with hyphened domain names Code from @n00dl3's comment on the issue. Closes #158 Not sure whether build the files to JS, or if that is done during a release cut. Running `cake build` on `master` builds more changes than just this one, so I am unsure. --- src/core/io.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/io.coffee b/src/core/io.coffee index 512672ab..8b35d030 100644 --- a/src/core/io.coffee +++ b/src/core/io.coffee @@ -1,7 +1,7 @@ # Various I/O based operations class Caman.IO # Used for parsing image URLs for domain names. - @domainRegex: /(?:(?:http|https):\/\/)((?:\w+)\.(?:(?:\w|\.)+))/ + @domainRegex: /(?:(?:http|https):\/\/)((?:[a-zA-Z0-9_-]+)\.(?:(?:[a-zA-Z0-9_-]*|\.)+))/; # Is the given URL remote? # If a cross-origin setting is set, we assume you have CORS @@ -110,4 +110,4 @@ Caman::toBase64 = (type = "png") -> type = type.toLowerCase() return @canvas.toDataURL "image/#{type}" -IO = Caman.IO \ No newline at end of file +IO = Caman.IO