Skip to content

Commit

Permalink
adding in url
Browse files Browse the repository at this point in the history
  • Loading branch information
veverkap authored and lpil committed Aug 11, 2019
1 parent f691165 commit f6896b4
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/icalendar/util/deserialize.ex
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,13 @@ defmodule ICalendar.Util.Deserialize do
%{acc | geo: to_geo(geo)}
end

def parse_attr(
%Property{key: "URL", value: url},
acc
) do
%{acc | url: url |> desanitized() |> String.downcase()}
end

def parse_attr(_, acc), do: acc

@doc ~S"""
Expand Down
21 changes: 21 additions & 0 deletions test/icalendar/deserialize_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,26 @@ defmodule ICalendar.DeserializeTest do
event = ICalendar.from_ics(ics)
assert event.description == "CR+LF line endings"
end

test "with URL" do
ics = """
BEGIN:VEVENT
DESCRIPTION:Escape from the world. Stare at some water.
COMMENT:Don't forget to take something to eat !
URL:http://google.com
SUMMARY:Going fishing
DTEND:20151224T084500Z
DTSTART:20151224T083000Z
LOCATION:123 Fun Street\\, Toronto ON\\, Canada
STATUS:TENTATIVE
CATEGORIES:Fishing,Nature
CLASS:PRIVATE
GEO:43.6978819;-79.3810277
END:VEVENT
"""

event = ICalendar.from_ics(ics)
assert event.url == "http://google.com"
end
end
end

0 comments on commit f6896b4

Please sign in to comment.