Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/image endpoints for nested images #154

Merged
merged 4 commits into from
Apr 19, 2021
Merged

Conversation

kwajiehao
Copy link
Contributor

@kwajiehao kwajiehao commented Apr 15, 2021

Overview

Currently, our backend endpoints for images cannot handle changes to images in nested directories. That's because the endpoints that we're hitting on GitHub assume that there is only one directory where we store all images: the images directory in the root of the repo.

This PR updates the following endpoints:

  • POST /:siteName/images
  • GET /:siteName/images/:imageName
  • POST /:siteName/images/:imageName/rename/:newImageName
    So that we can read, create, and rename individual images that are in nested directories. I also updated these endpoints to use the MediaFile (renamed from ImageFile) class instead of the File class that was being used before.

As part of this PR, changes were also made to the MediaFile class so that the ImageType class used accepts an argument in its constructor which determines the base API endpoint. This allows us to set the base endpoint to be a nested directory instead of the root images directory.

This commit modifies the ImageFile class so that the base endpoint
reflects the nested directory of an image, instead of assuming that
the base endpoint is the top level 'images' directory
… targets

This commit updates the image upload endpoint to use the ImageFile
class type so that it's consistent with the image reading endpoint.
In doing so, we also allow users to create images in nested directories.
This commit updates the image renaming endpoint to use the ImageFile
class, and to deal with nested images.
Copy link
Contributor

@alexanderleegs alexanderleegs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@kwajiehao kwajiehao merged this pull request into staging Apr 19, 2021
@kwajiehao kwajiehao deleted the fix/imageFile-class branch April 19, 2021 11:26
@alexanderleegs alexanderleegs restored the fix/imageFile-class branch April 20, 2021 10:13
@alexanderleegs alexanderleegs deleted the fix/imageFile-class branch April 22, 2021 06:34
@alexanderleegs alexanderleegs restored the fix/imageFile-class branch April 30, 2021 02:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants