Images can be created with leading slashes
To ensure we have unique image URLs despite the ImageServer/Image divide, the ImageServer.url
field has its trailing slashes stripped, and the Image.path
field should have its leading slashes stripped. When we want to build an image URL, we can then do f'{server.url}/{image.path}'
. When I was writing better tests for CreateImage
in !1900 (merged), I found that it was perfectly possible to create images with leading slashes in their paths:
>>> cli.request('CreateImage', body={'path': '/a/b/c'})
{
"id": "3e45338a-906e-4148-8cb7-f1f4c450add4",
"path": "/a/b/c",
# ...
}
This should instead have stripped the slash from the path, returning a/b/c
.
#513 documents a case where this could have been happening a long time ago with the ImageServer merge feature, but it turns you can just as easily get it with the API. This can lead to trouble when creating images as you could create a duplicate that would cause the error in #148 to reappear.