mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
🐛 Allowed .ico files to be uploaded for icons. (#10820)
closes #10641 There is already an "icons" section in this json file, but it appears that that is only used for v0.1 in which there was a "/uploads/icon" route that passed in a "type" of "icons" to the validation middleware. However, in v2, there is only a generic "/images/upload" route that is used for both icons and images, which passes a "type" of "images" so the .ico information needs to be added to the "images" section of the json file.
This commit is contained in:
parent
15a3dacf26
commit
6ca34a29fd
2 changed files with 15 additions and 12 deletions
|
@ -33,8 +33,8 @@
|
|||
"contentTypes": ["text/csv", "application/csv", "application/octet-stream"]
|
||||
},
|
||||
"images": {
|
||||
"extensions": [".jpg", ".jpeg", ".gif", ".png", ".svg", ".svgz"],
|
||||
"contentTypes": ["image/jpeg", "image/png", "image/gif", "image/svg+xml"]
|
||||
"extensions": [".jpg", ".jpeg", ".gif", ".png", ".svg", ".svgz", ".ico"],
|
||||
"contentTypes": ["image/jpeg", "image/png", "image/gif", "image/svg+xml", "image/x-icon", "image/vnd.microsoft.icon"]
|
||||
},
|
||||
"icons": {
|
||||
"extensions": [".png", ".ico"],
|
||||
|
|
|
@ -37,7 +37,7 @@ describe('Importer', function () {
|
|||
});
|
||||
|
||||
it('gets the correct extensions', function () {
|
||||
ImportManager.getExtensions().should.be.instanceof(Array).and.have.lengthOf(10);
|
||||
ImportManager.getExtensions().should.be.instanceof(Array).and.have.lengthOf(11);
|
||||
ImportManager.getExtensions().should.containEql('.json');
|
||||
ImportManager.getExtensions().should.containEql('.zip');
|
||||
ImportManager.getExtensions().should.containEql('.jpg');
|
||||
|
@ -45,7 +45,7 @@ describe('Importer', function () {
|
|||
});
|
||||
|
||||
it('gets the correct types', function () {
|
||||
ImportManager.getContentTypes().should.be.instanceof(Array).and.have.lengthOf(10);
|
||||
ImportManager.getContentTypes().should.be.instanceof(Array).and.have.lengthOf(12);
|
||||
ImportManager.getContentTypes().should.containEql('application/octet-stream');
|
||||
ImportManager.getContentTypes().should.containEql('application/json');
|
||||
ImportManager.getContentTypes().should.containEql('application/zip');
|
||||
|
@ -61,27 +61,27 @@ describe('Importer', function () {
|
|||
|
||||
it('globs extensions correctly', function () {
|
||||
ImportManager.getGlobPattern(ImportManager.getExtensions())
|
||||
.should.equal('+(.jpg|.jpeg|.gif|.png|.svg|.svgz|.json|.md|.markdown|.zip)');
|
||||
.should.equal('+(.jpg|.jpeg|.gif|.png|.svg|.svgz|.ico|.json|.md|.markdown|.zip)');
|
||||
ImportManager.getGlobPattern(ImportManager.getDirectories())
|
||||
.should.equal('+(images|content)');
|
||||
ImportManager.getGlobPattern(JSONHandler.extensions)
|
||||
.should.equal('+(.json)');
|
||||
ImportManager.getGlobPattern(ImageHandler.extensions)
|
||||
.should.equal('+(.jpg|.jpeg|.gif|.png|.svg|.svgz)');
|
||||
.should.equal('+(.jpg|.jpeg|.gif|.png|.svg|.svgz|.ico)');
|
||||
ImportManager.getExtensionGlob(ImportManager.getExtensions())
|
||||
.should.equal('*+(.jpg|.jpeg|.gif|.png|.svg|.svgz|.json|.md|.markdown|.zip)');
|
||||
.should.equal('*+(.jpg|.jpeg|.gif|.png|.svg|.svgz|.ico|.json|.md|.markdown|.zip)');
|
||||
ImportManager.getDirectoryGlob(ImportManager.getDirectories())
|
||||
.should.equal('+(images|content)');
|
||||
ImportManager.getExtensionGlob(ImportManager.getExtensions(), 0)
|
||||
.should.equal('*+(.jpg|.jpeg|.gif|.png|.svg|.svgz|.json|.md|.markdown|.zip)');
|
||||
.should.equal('*+(.jpg|.jpeg|.gif|.png|.svg|.svgz|.ico|.json|.md|.markdown|.zip)');
|
||||
ImportManager.getDirectoryGlob(ImportManager.getDirectories(), 0)
|
||||
.should.equal('+(images|content)');
|
||||
ImportManager.getExtensionGlob(ImportManager.getExtensions(), 1)
|
||||
.should.equal('{*/*,*}+(.jpg|.jpeg|.gif|.png|.svg|.svgz|.json|.md|.markdown|.zip)');
|
||||
.should.equal('{*/*,*}+(.jpg|.jpeg|.gif|.png|.svg|.svgz|.ico|.json|.md|.markdown|.zip)');
|
||||
ImportManager.getDirectoryGlob(ImportManager.getDirectories(), 1)
|
||||
.should.equal('{*/,}+(images|content)');
|
||||
ImportManager.getExtensionGlob(ImportManager.getExtensions(), 2)
|
||||
.should.equal('**/*+(.jpg|.jpeg|.gif|.png|.svg|.svgz|.json|.md|.markdown|.zip)');
|
||||
.should.equal('**/*+(.jpg|.jpeg|.gif|.png|.svg|.svgz|.ico|.json|.md|.markdown|.zip)');
|
||||
ImportManager.getDirectoryGlob(ImportManager.getDirectories(), 2)
|
||||
.should.equal('**/+(images|content)');
|
||||
});
|
||||
|
@ -342,18 +342,21 @@ describe('Importer', function () {
|
|||
|
||||
it('has the correct interface', function () {
|
||||
ImageHandler.type.should.eql('images');
|
||||
ImageHandler.extensions.should.be.instanceof(Array).and.have.lengthOf(6);
|
||||
ImageHandler.extensions.should.be.instanceof(Array).and.have.lengthOf(7);
|
||||
ImageHandler.extensions.should.containEql('.jpg');
|
||||
ImageHandler.extensions.should.containEql('.jpeg');
|
||||
ImageHandler.extensions.should.containEql('.gif');
|
||||
ImageHandler.extensions.should.containEql('.png');
|
||||
ImageHandler.extensions.should.containEql('.svg');
|
||||
ImageHandler.extensions.should.containEql('.svgz');
|
||||
ImageHandler.contentTypes.should.be.instanceof(Array).and.have.lengthOf(4);
|
||||
ImageHandler.extensions.should.containEql('.ico');
|
||||
ImageHandler.contentTypes.should.be.instanceof(Array).and.have.lengthOf(6);
|
||||
ImageHandler.contentTypes.should.containEql('image/jpeg');
|
||||
ImageHandler.contentTypes.should.containEql('image/png');
|
||||
ImageHandler.contentTypes.should.containEql('image/gif');
|
||||
ImageHandler.contentTypes.should.containEql('image/svg+xml');
|
||||
ImageHandler.contentTypes.should.containEql('image/x-icon');
|
||||
ImageHandler.contentTypes.should.containEql('image/vnd.microsoft.icon');
|
||||
ImageHandler.loadFile.should.be.instanceof(Function);
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue