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

Error: Image not found: images/... #797

Closed
Intelligent2013 opened this issue Sep 13, 2022 · 10 comments
Closed

Error: Image not found: images/... #797

Intelligent2013 opened this issue Sep 13, 2022 · 10 comments
Assignees
Labels

Comments

@Intelligent2013
Copy link
Contributor

Intelligent2013 commented Sep 13, 2022

Source ticket: #796
I'm trying to generate presentation XML for the document https://github.com/metanorma/iso-19135
bundle exec metanorma -t iso -x presentation document.adoc ended with created document.xml.abort and error:

(XML Line 004956): Image not found: images/D:/Work/Metanorma/repositories/iso-19135/sources/iso-19135-2021/images/lutaml/lutaml20220913-7144-s5djb6.png
	<figure id="_210e4bd5-d2a0-1dd1-37f5-68af543522fc">
	<name>Elements of the Register model</name>
	<image src="images/D:/Work/Metanorma/repositories/iso-19135/sources/iso-19135-2021/images/lutaml/lutaml20220913-7144-s5djb6.png" id="_54ab6cec-6beb-a71b-7050-6567f8f26a9d" mimetype="image/png" height="auto" width="auto"/></figure>
(XML Line 005271): Image not found: images/D:/Work/Metanorma/repositories/iso-19135/sources/iso-19135-2021/images/lutaml/lutaml20220913-7144-9w030j.png
	<figure id="_6be57c4b-b507-3057-bbda-aca3955bc211">
	<name>Identifiers in the Register</name>
	<image src="images/D:/Work/Metanorma/repositories/iso-19135/sources/iso-19135-2021/images/lutaml/lutaml20220913-7144-9w030j.png" id="_99edfe0f-11da-d423-9c2c-50d01a8850e3" mimetype="image/png" height="auto" width="auto"/></figure>
(XML Line 005392): Image not found: images/D:/Work/Metanorma/repositories/iso-19135/sources/iso-19135-2021/images/lutaml/lutaml20220913-7144-48e0d4.png
	<figure id="_57dd9bdb-d761-9510-c24a-d8ecefec2f10">
	<name>Register item statuses and relationships</name>
	<image src="images/D:/Work/Metanorma/repositories/iso-19135/sources/iso-19135-2021/images/lutaml/lutaml20220913-7144-48e0d4.png" id="_6a528a0e-8487-7109-c1b7-cfe0074c8310" mimetype="image/png" height="auto" width="auto"/></figure>
(XML Line 005570): Image not found: images/D:/Work/Metanorma/repositories/iso-19135/sources/iso-19135-2021/images/lutaml/lutaml20220913-7144-cd4c0k.png
	<figure id="_25001995-6d02-043c-cfbc-819535f2b006">
	<name>Proposal and Appeal</name>
	<image src="images/D:/Work/Metanorma/repositories/iso-19135/sources/iso-19135-2021/images/lutaml/lutaml20220913-7144-cd4c0k.png" id="_19688494-dc26-50b0-4100-ff3e066c5143" mimetype="image/png" height="auto" width="auto"/></figure>

The file D:/Work/Metanorma/repositories/iso-19135/sources/iso-19135-2021/images/lutaml/lutaml20220913-7144-9w030j.png physically is present on the disk, but there is a strange prefix images/ before D:/Work.

It seems this issue occurs on Win platform only: https://github.com/metanorma/iso-19135/actions/runs/3040514350/jobs/4896647319

@ronaldtse
Copy link
Contributor

I think this may be an image processing problem after the incorporation of pngcheck. Ping @opoudjis .

@ronaldtse ronaldtse moved this from 🆕 New to 🌋 Urgent in Metanorma Sep 13, 2022
@Intelligent2013
Copy link
Contributor Author

Some investigation - see #796 (comment).

@Intelligent2013
Copy link
Contributor Author

The paths in the src should be relative, not absolute.
(metanorma/metanorma-cli#255)

For instance, in the presentation XML generated on Ubuntu (found in /home/testuser/iso-19135/sources/iso-19135-2021/), instead of

<image src="/home/testuser/iso-19135/sources/iso-19135-2021/images/lutaml/lutaml20220913-4327-zyjutc.png" 

expected:

<image src="./images/lutaml/lutaml20220913-4327-zyjutc.png" 

@opoudjis opoudjis moved this from 🌋 Urgent to 🏗 In progress in Metanorma Sep 22, 2022
@opoudjis
Copy link
Contributor

opoudjis commented Sep 23, 2022

I think I know what happened with images prefix: D:/ not being recognised as an absolute path in metanorma-utils.

It used to, and I have no idea what changed.

@opoudjis
Copy link
Contributor

opoudjis commented Sep 24, 2022

What changed is @ronaldtse taking it upon himself to refactor metanorma-utils in metanorma/metanorma-utils@aee97ac , and introducing several bugs in the process, including this.

@ronaldtse I have enough to do already without you disrupting functioning code. You also committed that code without giving me the opportunity to review it. This is not acceptable, and I will revert any future commits you make to Metanorma code if you have not first discussed them with me. Only PRs are acceptable.

opoudjis added a commit to metanorma/metanorma-utils that referenced this issue Sep 24, 2022
Repository owner moved this from 🏗 In progress to ✅ Done in Metanorma Sep 24, 2022
@Intelligent2013
Copy link
Contributor Author

@opoudjis with latest metanorma-utils commit '3803557a36d3...' I get the error:

Fatal Error: undefined local variable or method `uri' for Metanorma::Utils:Module

          warn "Image specified at `#{uri}` does not exist."
                                       ^^^                  

Did you mean?  URI
C:/tools/ruby31/lib/ruby/gems/3.1.0/bundler/gems/metanorma-utils-3803557a36d3/lib/utils/image.rb:140:in `datauri1': undefined local variable or method `uri' for Metanorma::Utils:Module (NameError)

          warn "Image specified at `#{uri}` does not exist."\r

Did you mean?  URI

        from C:/tools/ruby31/lib/ruby/gems/3.1.0/bundler/gems/metanorma-utils-3803557a36d3/lib/utils/image.rb:135:in `datauri'
        from C:/tools/ruby31/lib/ruby/gems/3.1.0/bundler/gems/metanorma-standoc-35e26a016582/lib/metanorma/standoc/cleanup_image.rb:67:in `block in img_cleanup'

@ronaldtse
Copy link
Contributor

The problem with the latest crash is @opoudjis artificially split a method that is not supposed to be split:
metanorma/metanorma-utils@7f20637#diff-365195b15b8cb4ad83fe5e25c64e72b0206de119661460ea4a5ad8752e345a5aR138-R142

That these "method splits" should not happen and is representative of poor practice.

@opoudjis opoudjis reopened this Sep 25, 2022
Repository owner moved this from ✅ Done to 🏗 In progress in Metanorma Sep 25, 2022
@opoudjis
Copy link
Contributor

That these "method splits" should not happen and is representative of poor practice.

I'm not the one who decided 10 lines per method is good practice.

opoudjis added a commit to metanorma/metanorma-utils that referenced this issue Sep 25, 2022
@opoudjis
Copy link
Contributor

Hotfix metanorma-utils released, @Intelligent2013

Repository owner moved this from 🏗 In progress to ✅ Done in Metanorma Sep 25, 2022
@ronaldtse
Copy link
Contributor

@opoudjis the current behavior you committed does not generate datauri for an absolute file path. See the correct fix at metanorma/metanorma-utils#24 with specs.

@ronaldtse ronaldtse removed this from Metanorma Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants