bafolts / tplant

Typescript to plantuml
https://segmentationfaults.com/tplant/default.html
GNU General Public License v3.0
267 stars 34 forks source link

Broken .png files. #40

Closed David-Else closed 1 year ago

David-Else commented 5 years ago

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 )

JDThralls commented 4 years ago

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>
bafolts commented 4 years ago

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 commented 4 years ago

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.

mbnoimi commented 3 years ago

Still occurs in tplant version 2.3.3

lcy19 commented 1 year ago

Still occurs in tplant version 3.1.0, any suggestions?

bafolts commented 1 year ago

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

bafolts commented 1 year ago

@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.

lcy19 commented 1 year ago

@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
bafolts commented 1 year ago

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

lcy19 commented 1 year ago

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