OfficeDev / PnP-WOPI

Patterns and Practices repo for Office Online integration via WOPI Host
MIT License
86 stars 41 forks source link

Validation Test Fails BaseWopi=> PutUnlockedFile #6

Closed HiranPeri closed 4 years ago

HiranPeri commented 8 years ago

Code written in WopiFileRepository.cs in function UpdateFileContent having following code if (!file.IsLocked) { if (stream.Length > 0) return new Tuple<HttpStatusCode, string>(HttpStatusCode.Conflict, string.Empty); } else { if (!file.IsSameLock(lockValue)) return new Tuple<HttpStatusCode, string>(HttpStatusCode.Conflict, file.LockValue); } The if condition that checks Length of stream should actually check length of current file instead of incoming request per documentation here.... http://wopi.readthedocs.io/projects/wopirest/en/latest/files/PutFile.html

When a host receives a PutFile request on a file that is not locked, the host must check the current size of the file. If it is 0 bytes, the PutFile request should be considered valid and should proceed. If it is any value other than 0 bytes, or is missing altogether, the host should respond with a 409 Conflict.

So the host should return 200 instead of 409 every time.