Removed /uploads* endpoints

refs #10438
This commit is contained in:
Nazar Gargol 2019-02-22 11:20:08 +07:00
parent dfd350bd69
commit 187636193b
3 changed files with 8 additions and 34 deletions

View File

@ -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'),

View File

@ -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'))

View File

@ -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'))