tplant icon indicating copy to clipboard operation
tplant copied to clipboard

Broken .png files.

Open David-Else opened this issue 5 years ago • 4 comments

Hi,

Today I tried to create a .png file twice and both times they came back corrupted and unable to display. File length 111.2 kB. The .svg is still working fine.

"uml": "tplant --input src/app.ts --output uml-diagram.png"

( tplant --version 2.3.0 )

David-Else avatar Jun 07 '19 12:06 David-Else

This problem still exists, but now it's the same for SVG files as well. Reading the png file as UTF8 without BOM gives some more information as the file is an error page returned by the server:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>You don't have permission to access /plantuml/png/[hash removed]
on this server.<br />
</p>
</body></html>

JDThralls avatar Jun 15 '20 10:06 JDThralls

This is attempting to hit plantuml.com/plantuml/png/[hash]. This must have started failing requests.

https://github.com/bafolts/tplant/blob/master/src/index.ts#L138

Will need a different mechanism to generate these images.

bafolts avatar Jun 17 '20 01:06 bafolts

I am guessing we ended up hitting a server running.

https://www.npmjs.com/package/node-plantuml

Most likely need to update this tool to use that package when generating the image.

bafolts avatar Jun 17 '20 01:06 bafolts

Still occurs in tplant version 2.3.3

mbnoimi avatar Dec 24 '20 13:12 mbnoimi

Still occurs in tplant version 3.1.0, any suggestions?

lcy19 avatar Feb 24 '23 00:02 lcy19

Has been no fix to this. We still rely on the hosted file server. Will need an update to generate the images locally.

bafolts avatar Feb 24 '23 22:02 bafolts

@lcy19 can you test #102 ? That will generate the images locally and no longer depend on the server. Anyone else in this thread can feel free to test the PR on their machine then I will merge and push new version.

bafolts avatar Feb 28 '23 14:02 bafolts

@bafolts Thanks for your work. I tried in Mac mini (M1, 2020), it works for svg and puml,but png is still not work. I'm not sure the way I test whether is right. First download your code, then

npm install
npm run build

and then using index.js in dist folder. The test files are livekit/server-sdk-js,and test commands are

node ./index.js -i server-sdk-js/src/**/*.ts -o tmp.png

lcy19 avatar Mar 01 '23 00:03 lcy19

The way you tested is right. If you open tmp.png does it have image of an error?

bafolts avatar Mar 01 '23 14:03 bafolts

yes, using vscode to open it and error like this image

BTW, when I run npm install, it reports some error, so using npm install --force image

I'm not sure whether this problem is about node version, my using node version is v16.15.1

lcy19 avatar Mar 02 '23 00:03 lcy19