Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail convert if "convert_to" consists of three parts #27

Open
arnisoft opened this issue Oct 14, 2019 · 2 comments · May be fixed by #35
Open

Fail convert if "convert_to" consists of three parts #27

arnisoft opened this issue Oct 14, 2019 · 2 comments · May be fixed by #35

Comments

@arnisoft
Copy link

To convert a document to HTML with embdedded images, you must use convert_to param 'html:HTML:EmbedImages'.
For example:
Libreconv.convert('document.docx', '/Users/ricn/pdf_documents/my_document_as.html', nil, 'html:HTML:EmbedImages')

But this code fail at

target_tmp_file = File.join(
          target_path,
          File.basename(@escaped_source_path, '.*') + '.' +
            File.basename(@convert_to, ':*')
        )

because generating output filename extension File.basename(@convert_to, ':*') returns 'html:HTML'.
This is incorrect filename extension.

I think code
File.basename(@convert_to, ':*')
must be replaced by something like this
@convert_to.split(':').first

@ndbroadbent
Copy link
Member

ndbroadbent commented Oct 14, 2019

Ah, thanks for letting me know about that! Would you have some time to add a new test case for a doc with embedded images? The test could ensure that the HTML contains some expected test, and the the images are embedded properly. It would be great if you could please submit a PR to fix this issue. Thanks!

yhirano55 added a commit to yhirano55/libreconv that referenced this issue Apr 13, 2023
fix DocSpring#27

When the target format was 'html:HTML:EmbededImages', the current implementation of
the extension extraction logic generated an incorrect file extension of 'html:HTML'.

To address this issue, we have revised the extension extraction logic to correctly
identify and generate the appropriate file extension for the target format.
@yhirano55
Copy link

@ndbroadbent Pull request #35 has resolved this issue. Could you please review the changes and confirm that they have addressed the problem?

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

Successfully merging a pull request may close this issue.

3 participants