Skip to content
This repository has been archived by the owner on Mar 14, 2019. It is now read-only.

Is there no support for Adobe inDesign files? #1022

Open
kjrhody opened this issue Jan 3, 2018 · 4 comments
Open

Is there no support for Adobe inDesign files? #1022

kjrhody opened this issue Jan 3, 2018 · 4 comments

Comments

@kjrhody
Copy link

kjrhody commented Jan 3, 2018

Is there support for inDesign (.indd, .idml) files with this? From what I can see, the type property for files with that extension continues to be empty despite my best efforts, and errors out on the insert (Error is: Uncaught Error: FS.Collection insert: file does not pass collection filters). My code is this:

HighResFiles = new FS.Collection("highResFiles", {
    stores: [highResStore, highResThumbStore],
    filter: {
        maxSize: 524288000, //500 MB in bytes
        allow: {
            contentTypes: [
                'image/*', 'application/pdf', 'application/octet-stream', 'application/postscript', 'application/msword',
                'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.ms-excel',
                'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/illustrator',
                'application/vnd.ms-powerpoint', 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
                'application/x-indesign'
            ],
            extensions: ['png', 'gif', 'jpg', 'jpeg', 'tif', 'tiff', 'bmp', 'eps', 'svg', 'ps', 'pdf', 'psd', 'doc', 'docx', 'xls', 'xlsx', 'ai', 'ppt', 'pptx', 'indd', 'idml']
        }
    }
});

and

function highResFileUpload(event, template, currentGraphic){
    FS.Utility.eachFile(event, function(file) {
        checkCFSFileType(file, HighResFiles);

       // Here I've tried to account for at least an .indd file but it still errors out
 var fileExtension = _.last(file.name.split('.'));
        if (file.type === "" && fileExtension === "indd"){
            var fileType = "application/x-indesign";
            console.log(fileType);
        } else {
            var fileType = file.type;
            console.log(fileType);

        }

        let newFile = new FS.File();

        newFile.attachData(file, {type: fileType}, function (error) {
            if (error) {
                sAlert.error('Error uploading file: ' + error);
                throw new Meteor.Error("CFS file upload failed");
            }
            newFile.name(file.name);
            newFile.metadata = {
                owner: Meteor.userId(),
                modifiedDate: new Date(Date.parse(file.lastModifiedDate)),
                project_identifier: currentGraphic.project_identifier
            };

            let highResFile = HighResFiles.insert(newFile);

            Graphics.update({_id: currentGraphic._id}, {$push: {highResFiles: highResFile._id}}, function(error){
                if (error) {
                    sAlert.error('Error updating graphic: ' + error);
                    throw new Meteor.Error("Error updating graphic");
                }
                //sAlert.success(currentGraphic.identifier + ' successfully updated');
            });
        });
    });
}
@nooitaf
Copy link
Contributor

nooitaf commented Jan 8, 2018

Can you give us an example InDesign file which is not working for you?

@kjrhody
Copy link
Author

kjrhody commented Jan 8, 2018

@nooitaf It looks like github doesn't support upload of that file type (.indd) so I had to compress it into a .zip

indesign_figure_Test_v1.indd.zip

@kjrhody
Copy link
Author

kjrhody commented Jan 30, 2018

@nooitaf Any update? Were you able to get the file to work?

@nooitaf
Copy link
Contributor

nooitaf commented Jan 31, 2018

Sry and thanks for needed ping :)

I downloaden and extracted the zip you uploaded.

The first thing i noticed was that it's a directory, similar to .application/.app "files" on the mac.

$ tree indesign_figure_Test_v1.indd -a

indesign_figure_Test_v1.indd
├── indesign_figure_Test_v1.indd
└── __MACOSX
    └── ._indesign_figure_Test_v1.indd

The directory contains a binary file.

When i check the binary file for it's mime-type with file i get

$ file --mime-encoding --mime-type indesign_figure_Test_v1.indd 

indesign_figure_Test_v1.indd: application/octet-stream; charset=binary

I did a local and production upload check and if you upload the binary file inside, it just works.

You can normaly see the contents of those folders with right click > show-package-contents

I hope this helps

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants