-
Notifications
You must be signed in to change notification settings - Fork 55
Open
Description
I was attempting to scan through files to find ones with a particular property set, and ran into an error:
3: from /work/gitlab/experiments/sharepoint-label-scan/.bundle/ruby/2.6.0/gems/sharepoint-ruby-0.1.1/lib/sharepoint-properties.rb:27:in `block in add_property'
2: from /work/gitlab/experiments/sharepoint-label-scan/.bundle/ruby/2.6.0/gems/sharepoint-ruby-0.1.1/lib/sharepoint-properties.rb:67:in `get_property'
1: from /work/gitlab/experiments/sharepoint-label-scan/.bundle/ruby/2.6.0/gems/sharepoint-ruby-0.1.1/lib/sharepoint-properties.rb:83:in `get_deferred_property'
/work/gitlab/experiments/sharepoint-label-scan/.bundle/ruby/2.6.0/gems/sharepoint-ruby-0.1.1/lib/sharepoint-ruby.rb:86:in `query': The expression "Web/GetFileByServerRelativePath(decodedurl='/sites/CAD/UNITED STATES/more-path-data/CAD Backgrounds 4.26.2019/A18-Build Out-Floor Plan - PARTIAL FOURTH FLOOR PLAN - PART 'C'.dwg')/Properties" is not valid. (Sharepoint::SPException)
It seems that while this value does get properly url-encoded with %27 instead of a single apostrophe ', it doesn't seem to be what sharepoint wants. Apparently sharepoint wants two apostrophes '' instead of a single apostrophe.
While I think the proper fix is probably in sharepoint-ruby.rb (in #api_path), the simple fix I used was to change this in sharepoint-properties.rb:
# line 80-84
def get_deferred_property property_name
deferred_data = @data[property_name]['__deferred']
uri = deferred_data['uri'].gsub(/^http.*\/_api\/web\//i, '').gsub(/%27/, "''")
@site.query :get, uri
endThough, I'm not sure deferred uri's are used anywhere else, so it might be considered reasonable.
Metadata
Metadata
Assignees
Labels
No labels