core/server/data/importer/index.js
function (directory) {
        // Globs match content in the root or inside a single directory
        var extMatchesBase = glob.sync(this.getExtensionGlob(this.getExtensions(), ROOT_OR_SINGLE_DIR), {cwd: directory}),
            extMatchesAll = glob.sync(
                this.getExtensionGlob(this.getExtensions(), ALL_DIRS), {cwd: directory}
            ),
            dirMatches = glob.sync(
                this.getDirectoryGlob(this.getDirectories(), ROOT_OR_SINGLE_DIR), {cwd: directory}
            ),
            oldRoonMatches = glob.sync(this.getDirectoryGlob(['drafts', 'published', 'deleted'], ROOT_OR_SINGLE_DIR),
                {cwd: directory});

        // This is a temporary extra message for the old format roon export which doesn't work with Ghost
        if (oldRoonMatches.length > 0) {
            throw new common.errors.UnsupportedMediaTypeError({message: common.i18n.t('errors.data.importer.index.unsupportedRoonExport')});
        }

        // If this folder contains importable files or a content or images directory
        if (extMatchesBase.length > 0 || (dirMatches.length > 0 && extMatchesAll.length > 0)) {
            return true;
        }

        if (extMatchesAll.length < 1) {
            throw new common.errors.UnsupportedMediaTypeError({message: common.i18n.t('errors.data.importer.index.noContentToImport')});
        }

        throw new common.errors.UnsupportedMediaTypeError({message: common.i18n.t('errors.data.importer.index.invalidZipStructure')});
    }
function (directory) {
        // Globs match content in the root or inside a single directory
        var extMatchesBase = glob.sync(this.getExtensionGlob(this.getExtensions(), ROOT_OR_SINGLE_DIR), {cwd: directory}),
            extMatchesAll = glob.sync(
                this.getExtensionGlob(this.getExtensions(), ALL_DIRS), {cwd: directory}
            ),
            dirMatches = glob.sync(
                this.getDirectoryGlob(this.getDirectories(), ROOT_OR_SINGLE_DIR), {cwd: directory}
            ),
            oldRoonMatches = glob.sync(this.getDirectoryGlob(['drafts', 'published', 'deleted'], ROOT_OR_SINGLE_DIR),
                {cwd: directory});

        // This is a temporary extra message for the old format roon export which doesn't work with Ghost
        if (oldRoonMatches.length > 0) {
            throw new common.errors.UnsupportedMediaTypeError({message: common.i18n.t('errors.data.importer.index.unsupportedRoonExport')});
        }

        // If this folder contains importable files or a content or images directory
        if (extMatchesBase.length > 0 || (dirMatches.length > 0 && extMatchesAll.length > 0)) {
            return true;
        }

        if (extMatchesAll.length < 1) {
            throw new common.errors.UnsupportedMediaTypeError({message: common.i18n.t('errors.data.importer.index.noContentToImport')});
        }

        throw new common.errors.UnsupportedMediaTypeError({message: common.i18n.t('errors.data.importer.index.invalidZipStructure')});
    }
function ( directory ) { // Globs match content in the root or inside a single directory var extMatchesBase = glob . sync ( this . getExtensionGlob ( this . getExtensions ( ) , ROOT_OR_SINGLE_DIR ) , { cwd : directory } ) , extMatchesAll = glob . sync ( this . getExtensionGlob ( this . getExtensions ( ) , ALL_DIRS ) , { cwd : directory } ) , dirMatches = glob . sync ( this . getDirectoryGlob ( this . getDirectories ( ) , ROOT_OR_SINGLE_DIR ) , { cwd : directory } ) , oldRoonMatches = glob . sync ( this . getDirectoryGlob ( [ 'drafts' , 'published' , 'deleted' ] , ROOT_OR_SINGLE_DIR ) , { cwd : directory } ) ; // This is a temporary extra message for the old format roon export which doesn't work with Ghost if ( oldRoonMatches . length > 0 ) { throw new common . errors . UnsupportedMediaTypeError ( { message : common . i18n . t ( 'errors.data.importer.index.unsupportedRoonExport' ) } ) ; } // If this folder contains importable files or a content or images directory if ( extMatchesBase . length > 0 || ( dirMatches . length > 0 && extMatchesAll . length > 0 ) ) { return true ; } if ( extMatchesAll . length < 1 ) { throw new common . errors . UnsupportedMediaTypeError ( { message : common . i18n . t ( 'errors.data.importer.index.noContentToImport' ) } ) ; } throw new common . errors . UnsupportedMediaTypeError ( { message : common . i18n . t ( 'errors.data.importer.index.invalidZipStructure' ) } ) ; }
Checks the content of a zip folder to see if it is valid.
Importable content includes any files or directories which the handlers can process
Importable content must be found either in the root, or inside one base directory

@param {String} directory
@returns {Promise}
Checks the content of a zip folder to see if it is valid . Importable content includes any files or directories which the handlers can process Importable content must be found either in the root or inside one base directory