@
mike (mike@unfediverse.com) What am I doing wrong?
An addon stores a json using
$file->put(json_encode($faces_replaced));
Example
{
"id":{"0":"AsGPgFifqwBRXSr","1":"KERRkttLsZbwkrk"},
"file":{"0":"handy\/2022-05-25_21-22-27_Abendessen in Laag - GM1917.jpg","1":"handy\/2022-05-30_09-27-49_Ivan im Caf\u00e9 in Monaco - GM1917.jpg"},
"position":{"0":[53,37,29,54],"1":[14,74,25,55]},
"face_nr":{"0":1,"1":1},"name":{"0":"ivanu","1":""},"name_recognized":{"0":"","1":""},
"time_named":{"0":"2022-08-24T12:42:30+00:00","1":""},
"exif_date":{"0":"2022-05-25T21:22:27+02:00","1":"2022-05-30T09:27:49+02:00"}
}
What is working
The content of the file is correct if opened in the file system directly, example var/www/mywebsite/store/oj/98216e6f-f392-4af9-ac71-671e4688c03e/fc641786-f49f-47ea-8f41-cc4e2cd7520d
(If php reads the file using Code\Storage\File the file content is correct, as well as read by the python backend that reads the file from the file system directly.)
What is not working
If the file is opened in the webbrowser, example
http://localhost/cloud/oj/handy/faces.json, the browser shows "SyntaxError: JSON.parse: unterminated string literal at line 1 column 404 of the JSON data". Indeed, if the file is downloaded the file content is
{
"id":{"0":"AsGPgFifqwBRXSr","1":"KERRkttLsZbwkrk"},
"file":{"0":"handy\/2022-05-25_21-22-27_Abendessen in Laag - GM1917.jpg","1":"handy\/2022-05-30_09-27-49_Ivan im Caf\u00e9 in Monaco - GM1917.jpg"},
"position":{"0":[53,37,29,54],"1":[14,74,25,55]},
"face_nr":{"0":1,"1":1},
"name":{"0":"ivanu","1":""},
"name_recognized":{"0":"","1":""},
"time_named":{"0":"2022-08-24T12:42:30+00:00","1":""},
"exif_date":{"
If repeated it gives the same result.
This is a problem because if the browser tries to load the file via
http://localhost/cloud/oj/handy/faces.json this will fail.
I keep searching for the cause...