pdfcpu / pdfcpu

A PDF processor written in Go.

Home Page:http://pdfcpu.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Latest wasm build doesn't work with latest wasm_execs

LaserKaspar opened this issue · comments

Thank you for submitting a possible bug!

Please ensure the following:

  • Your issue is based on the latest commit
  • State your OS and OS version
  • When reporting a problem with a specific PDF input file please avoid stating the organization responsible for the PDFWriter - just refer to the PDFWriter

Latest Commit: Yes
OS: Windows 10 19045.4239

Bug Description

When running any command with arguments, I get the following error:
pdfcpu: config dir problem: permissions is numeric, got: 0xF0C3

I tried using the released wasm module as well as compiling myself. Both produce the same error.

Steps to reproduce

pdfcpu.zip

In Node:
node wasm_exec_node.js pdfcpu.wasm version

In Browser:
node static_server.js -> Open (http://localhost:8888/wasm_exec.html)[http://localhost:8888/wasm_exec.htm]) -> Open Browser Console -> Press Run Button

Expected Output:
pdfcpu: config dir problem: permissions is numeric, got: 0xF0C3

MemFS does not cause the issue, same error can be produced without MemFS using the unmodified wasm_exec.js or wasm_exec_node.js.

Thanks for your help!

Sorry I am not a WASM expert.
@henrixapp can you help out?

Hi,

I am a little bit out of the loop. But here are my thoughts:

This issue seams very similar to #231 and #232.

The error seems to be caused by trying to load/open a config file around here

fmt.Fprintf(os.Stderr, "pdfcpu: config dir problem: %v\n", err)

This config file will not exist/be openable in WASM env for security reasons.

I would propose to set

var ConfigPath string = "default"
to "disable" via api.DisableConfigDir() on wasm target. This can be done using build tags.

Best

Henrik