diff --git a/core/server/web/api/v2/admin/routes.js b/core/server/web/api/v2/admin/routes.js index dff1afbb01..c979771c21 100644 --- a/core/server/web/api/v2/admin/routes.js +++ b/core/server/web/api/v2/admin/routes.js @@ -192,32 +192,6 @@ module.exports = function apiRoutes() { router.get('/authentication/setup', api.http(api.authentication.isSetup)); // ## Images - // @TODO: remove /uploads/ in favor of /images/ in Ghost 3.x - router.post('/uploads', - mw.authAdminApi, - upload.single('uploadimage'), - shared.middlewares.validation.upload({type: 'images'}), - shared.middlewares.image.normalize, - http(apiv2.upload.image) - ); - - router.post('/uploads/profile-image', - mw.authAdminApi, - upload.single('uploadimage'), - shared.middlewares.validation.upload({type: 'images'}), - shared.middlewares.validation.profileImage, - shared.middlewares.image.normalize, - http(apiv2.upload.image) - ); - - router.post('/uploads/icon', - mw.authAdminApi, - upload.single('uploadimage'), - shared.middlewares.validation.upload({type: 'icons'}), - shared.middlewares.validation.blogIcon(), - http(apiv2.upload.image) - ); - router.post('/images', mw.authAdminApi, upload.single('uploadimage'), diff --git a/core/test/acceptance/old/admin/upload_spec.js b/core/test/acceptance/old/admin/upload_spec.js index a0cdb492b0..30e32c9413 100644 --- a/core/test/acceptance/old/admin/upload_spec.js +++ b/core/test/acceptance/old/admin/upload_spec.js @@ -29,7 +29,7 @@ describe('Upload API', function () { }); it('Can upload a png', function (done) { - request.post(localUtils.API.getApiQuery('uploads')) + request.post(localUtils.API.getApiQuery('images')) .set('Origin', config.get('url')) .expect('Content-Type', /json/) .attach('uploadimage', path.join(__dirname, '/../../../utils/fixtures/images/ghost-logo.png')) @@ -47,7 +47,7 @@ describe('Upload API', function () { }); it('Can upload a jpg', function (done) { - request.post(localUtils.API.getApiQuery('uploads')) + request.post(localUtils.API.getApiQuery('images')) .set('Origin', config.get('url')) .expect('Content-Type', /json/) .attach('uploadimage', path.join(__dirname, '/../../../utils/fixtures/images/ghosticon.jpg')) @@ -65,7 +65,7 @@ describe('Upload API', function () { }); it('Can upload a gif', function (done) { - request.post(localUtils.API.getApiQuery('uploads')) + request.post(localUtils.API.getApiQuery('images')) .set('Origin', config.get('url')) .expect('Content-Type', /json/) .attach('uploadimage', path.join(__dirname, '/../../../utils/fixtures/images/loadingcat.gif')) @@ -83,7 +83,7 @@ describe('Upload API', function () { }); it('Can upload a square profile image', function (done) { - request.post(localUtils.API.getApiQuery('uploads/profile-image')) + request.post(localUtils.API.getApiQuery('images/profile-image')) .set('Origin', config.get('url')) .expect('Content-Type', /json/) .attach('uploadimage', path.join(__dirname, '/../../../utils/fixtures/images/loadingcat_square.gif')) diff --git a/core/test/regression/api/v2/admin/upload_spec.js b/core/test/regression/api/v2/admin/upload_spec.js index bc17d243db..7e358e0a49 100644 --- a/core/test/regression/api/v2/admin/upload_spec.js +++ b/core/test/regression/api/v2/admin/upload_spec.js @@ -30,7 +30,7 @@ describe('Upload API', function () { it('Can\'t import fail without file', function () { return request - .post(localUtils.API.getApiQuery('uploads')) + .post(localUtils.API.getApiQuery('images')) .set('Origin', config.get('url')) .set('Accept', 'application/json') .expect('Content-Type', /json/) @@ -38,7 +38,7 @@ describe('Upload API', function () { }); it('Can\'t import with unsupported file', function (done) { - request.post(localUtils.API.getApiQuery('uploads')) + request.post(localUtils.API.getApiQuery('images')) .set('Origin', config.get('url')) .expect('Content-Type', /json/) .attach('uploadimage', path.join(__dirname, '/../../../../utils/fixtures/csv/single-column-with-header.csv')) @@ -53,7 +53,7 @@ describe('Upload API', function () { }); it('Can\'t upload incorrect extension', function (done) { - request.post(localUtils.API.getApiQuery('uploads')) + request.post(localUtils.API.getApiQuery('images')) .set('Origin', config.get('url')) .set('content-type', 'image/png') .expect('Content-Type', /json/) @@ -69,7 +69,7 @@ describe('Upload API', function () { }); it('Can\'t import if profile image is not square', function (done) { - request.post(localUtils.API.getApiQuery('uploads/profile-image')) + request.post(localUtils.API.getApiQuery('images/profile-image')) .set('Origin', config.get('url')) .expect('Content-Type', /json/) .attach('uploadimage', path.join(__dirname, '/../../../../utils/fixtures/images/favicon_not_square.png'))