Bug 134

Summary: /patient/modify gives 500, should really be 400
Product: Orthanc Reporter: Sébastien Jodogne <s.jodogne>
Component: Orthanc CoreAssignee: Sébastien Jodogne <s.jodogne>
Status: RESOLVED FIXED    
Severity: minor    
Priority: ---    
Version: unspecified   
Hardware: All   
OS: All   

Description Sébastien Jodogne 2020-06-29 15:15:19 CEST
[BitBucket user: Georg Grab]
[BitBucket date: 2019-02-15.11:48:25]

`/patient/modify` with this body `'{"Replace":{"StudyInstanceUID":"1.2.276.0.7230010.3.1.2.296485376.10.1550229194.304586"}}'`  gives me 
```
{
   "Details" : "Marking tag \"StudyInstanceUID\" as to be replaced requires the \"Force\" option to be set to true",
   "HttpError" : "Bad Request",
   "HttpStatus" : 400,
   "Message" : "Bad request",
   "Method" : "POST",
   "OrthancError" : "Bad request",
   "OrthancStatus" : 8,
   "Uri" : "/patients/dce3dd2d-50dd3710-b65352dd-f558e207-915aef8b/modify"
}
```

which is fine, but now if I do as I am told and include the desired `"Force": true`, I get a 500.

Here's what the Orthanc Verbose logs are saying to this:

```
T0215 11:46:48.422606 DicomModification.cpp:1136] Replace: StudyInstanceUID (0020,000d) == "1.2.276.0.7230010.3.1.2.296485376.10.1550229194.304586"

I0215 11:46:48.425416 JobsRegistry.cpp:712] New job submitted with priority 0: 80ff31c9-2384-4183-a631-ab3f7369c1ec
I0215 11:46:48.426299 JobsEngine.cpp:144] Executing job with priority 0 in worker thread 1: 80ff31c9-2384-4183-a631-ab3f7369c1ec
I0215 11:46:48.426456 ResourceModificationJob.cpp:142] Modifying instance in a job: 6a5a7425-a8898550-682e1074-e0e637bc-0740e563
T0215 11:46:48.426499 MemoryCache.cpp:47] Reusing a cache page
E0215 11:46:48.427382 OrthancException.h:85] Bad request: When modifying a patient, her PatientID is required to be modified
```

so I guess a 400 with a proper message saying I must set the PatientID if I wanted to do this would be the more expected response (please don't ask why I am attempting to modify the studyinstanceuid)

Thanks,
Georg
Comment 1 Sébastien Jodogne 2020-06-29 15:25:05 CEST
[BitBucket user: Sébastien Jodogne]
[BitBucket date: 2019-02-24.07:59:38]

Fixed in changeset: https://hg.orthanc-server.com/orthanc/changeset/e44e0127e5533f9feecce436444e92eb48b89200