Skip to content
This repository has been archived by the owner on Mar 8, 2018. It is now read-only.

there's no safe way currently to PUT an update to images in the images array #794

Closed
mhl opened this issue Mar 16, 2015 · 1 comment · Fixed by mysociety/popit-api#138
Closed

Comments

@mhl
Copy link
Contributor

mhl commented Mar 16, 2015

The _id field in each image in images is currently broken (see #470) in that one can't PUT back a version of the images array that contains those "_bsontype": "ObjectID' IDs - I found that you'll get a "Argument passed in must be a single String of 12 bytes or a string of 24 hex characters" error. I understand from what @chrismytton said that even if you PUT an _id with the 24 hex character ID, this still wouldn't work currently. If you don't include the _id then the images array will be updated, but the ID will be lost which creates problems for PopIt hosted images. (@chrismytton did a workaround so now such images don't 404, but other things are still broken, e.g. deleting such images by ID). This basically means that there's currently no way to safely PUT an update to images.

In user story terms: as a developer, I want to be able to PUT updates to the images array so that I can correct image metadata and reorder the images.

@chrismytton
Copy link
Member

Looking at the code it seems that it will deal with casting the images _id fields to a MongoDB ObjectId. So the actual issue here seems to be #470, which is causing problems when PUTing the images array back again.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants