From 4721b75463bbc01023736195ce451a606e3093ee Mon Sep 17 00:00:00 2001 From: Naz Date: Tue, 9 Nov 2021 16:15:57 +0400 Subject: [PATCH] Moved ``/media/thumbnail/` Admin API endpoint to `/media/thumbnail/upload` refs https://github.com/TryGhost/Toolbox/issues/120 - Changed endpoint name as it suits way better to the `/upload` postfix convention we use along with all other endpoints that support file uploads --- core/server/web/api/canary/admin/routes.js | 2 +- test/e2e-api/admin/media.test.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/server/web/api/canary/admin/routes.js b/core/server/web/api/canary/admin/routes.js index 256d47318b..85c1220a2e 100644 --- a/core/server/web/api/canary/admin/routes.js +++ b/core/server/web/api/canary/admin/routes.js @@ -244,7 +244,7 @@ module.exports = function apiRoutes() { apiMw.upload.mediaValidation({type: 'media'}), http(api.media.upload) ); - router.put('/media/thumbnail/', + router.put('/media/thumbnail/upload', labs.enabledMiddleware('mediaAPI'), mw.authAdminApi, apiMw.upload.single('file'), diff --git a/test/e2e-api/admin/media.test.js b/test/e2e-api/admin/media.test.js index e30a401823..d3414f21ec 100644 --- a/test/e2e-api/admin/media.test.js +++ b/test/e2e-api/admin/media.test.js @@ -86,7 +86,7 @@ describe('Media API', function () { }); }); - describe('media/thumbnail/:url', function () { + describe('media/thumbnail/upload', function () { it('Can update existing thumbnail', async function () { const res = await request.post(localUtils.API.getApiQuery('media/upload')) .set('Origin', config.get('url')) @@ -102,7 +102,7 @@ describe('Media API', function () { media.push(res.body.media[0].url.replace(config.get('url'), '')); media.push(res.body.media[0].thumbnail_url.replace(config.get('url'), '')); - const thumbnailRes = await request.put(localUtils.API.getApiQuery(`media/thumbnail/`)) + const thumbnailRes = await request.put(localUtils.API.getApiQuery(`media/thumbnail/upload`)) .set('Origin', config.get('url')) .expect('Content-Type', /json/) .field('url', res.body.media[0].url) @@ -127,7 +127,7 @@ describe('Media API', function () { media.push(res.body.media[0].url.replace(config.get('url'), '')); - const thumbnailRes = await request.put(localUtils.API.getApiQuery(`media/thumbnail/`)) + const thumbnailRes = await request.put(localUtils.API.getApiQuery(`media/thumbnail/upload`)) .set('Origin', config.get('url')) .expect('Content-Type', /json/) .field('url', res.body.media[0].url)