Anonymous avatar Anonymous committed 46af62b

check to see if client included a value for an "unreadable" property instead of blindly adding a value

blindly adding a value could create an object with multiple values for a field
changes to un-writable, un-readable properties will still be caught by check_write_mask

Comments (0)

Files changed (1)

src/jiak_resource.erl

 copy_unreadable1([H|T], OldObj, NewObj) ->
     copy_unreadable1(T, OldObj,
                      case proplists:lookup(H, OldObj) of
-                         {H, Val} -> [{H, Val}|NewObj];
-                         none     -> NewObj
+                         {H, Val} ->
+                             case proplists:lookup(H, NewObj) of
+                                 {H, _} ->
+                                     %% client included a value
+                                     %% catch any potential mismatch in
+                                     %% check_write_mask
+                                     NewObj;
+                                 none ->
+                                     [{H, Val}|NewObj]
+                             end;
+                         none -> NewObj
                      end).
 
 %% @spec pretty_print(webmachine:wrq(), context()) ->
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.