Skip to content

File parameters not interpreted as files  #60

@kostas-jonauskas

Description

@kostas-jonauskas

There is a bug in the library when passing multiple files to the converter. For example, DOCX to Compare conversion takes two files as parameters: File and CompareFile. The File parameter is interpreted as a file and sent to CARA as a file object. My guess is that the CompareFile is sent as a plain string (path to file) rather than the file itself. Conversion results in the following error:

 data: {
      Code: 5008,
      Message: 'Unable to access the file. Call failed with status code 500 (Internal Server Error). Remote file C:/Projects/stuff/Test projects/ConvertAPI NodeJs/file-2.docx'
 }

Code snippet to replicate the issue:

const convertapi = require('convertapi')(secret);
convertapi.convert('compare', {
	File: '/path/to/file-1.docx',
	CompareFile: '/path/to/file-2.docx',
	}, 'docx').then(function(res) {
		console.log(res);
})

Please note that there might be more conversions that accept multiple files as parameters, for example PDF watermark overlay (https://www.convertapi.com/pdf-to-watermark-overlay), so hardcoding the logic based on property name is not a good idea.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions