Commits

Bryan Fink  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

  • Participants
  • Parent commits e7058b5

Comments (0)

Files changed (1)

File 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()) ->