Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow empty parameter value #20

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/ri_cal/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def next_line #:nodoc:
def self.parse_params(string) #:nodoc:
if string
string.split(";").inject({}) { |result, val|
m = /^(.+)=(.+)$/.match(val)
m = /^(.+)=(.*)$/.match(val)
raise "Invalid parameter value #{val.inspect}" unless m
#TODO - The gsub below is a simplest fix for http://rick_denatale.lighthouseapp.com/projects/30941/tickets/19
# it may need further examination if more pathological cases show up.
Expand Down
5 changes: 5 additions & 0 deletions spec/ri_cal/parser_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
it "should strip surrounding quotes" do
RiCal::Parser.params_and_value(";TZID=\"(GMT-05.00) Eastern Time (US & Canada)\":20090804T120000").should == [{"TZID" => "(GMT-05.00) Eastern Time (US & Canada)"}, "20090804T120000"]
end

it "should allow empty x-parameter value" do
# Example from publicly shared iCloud calendar
RiCal::Parser.params_and_value(";X-ADDRESS=:geo:37.334722,-122.008889").should == [{"X-ADDRESS" => ""}, "geo:37.334722,-122.008889"]
end
end

def self.describe_property(entity_name, prop_name, params, value, type = RiCal::PropertyValue::Text)
Expand Down