jgraph / drawio

draw.io is a JavaScript, client-side editor for general diagramming.
https://www.drawio.com
Other
40.86k stars 7.6k forks source link

Website fails to load correctly - Minified JS files are out of sync with output from build.xml #1843

Closed GordonRudman closed 2 years ago

GordonRudman commented 3 years ago

Preflight Checklist

Describe the bug When self hosting the drawio code the website fails to load correctly if you run the etc\build\build.xml ant script. It works OK as long as you don't need to change anything :(

To Reproduce Steps to reproduce the behavior:

  1. Clone repo (https://github.com/jgraph/drawio.git)
  2. Host static website (from src\main\webapp)
  3. Everything is working correctly at this point
  4. Don't make any changes at all
  5. Run the etc\build\build.xml ant script.
  6. The build is successful and produces different minified files under 'src\main\webapp\js' .For example: app.mis.js, extensions.mi.js, stencils.min.js, etc
  7. These files seem to be very similar to the original files, but there are definite differences (especially with translations)
  8. Unfortunately these new files cause the website to fail to load, with errors regarding unicode encoding in stencils.min.js.

Expected behavior The build should produce exactly the same output as what is in the repo, or only different in trivial ways like timestamps etc.

Screenshots See attached

draw.io version (In the Help->About menu of the draw.io editor):

Desktop (please complete the following information):

Additional context This bug makes it impossible to customize the code

Clipboard02

davidjgraph commented 3 years ago

Could you please clone the repo to a public repo, run the build, post the output of the build in an issue on the repo and switch on GH pages for the project?

GordonRudman commented 3 years ago

Sure, no problem. I cloned the repo today at version 14.4.6.

I've created two repos - one for before the build where everything works ok, and one straight after the build and commit. You can find them here: Before build: https://github.com/GordonRudman/drawio-issue1843-beforeBuild After build: https://github.com/GordonRudman/drawio-issue1843-afterBuild

There are a couple of new commits to the 'After' repo that should hopefully be easy to follow. I also added a folder called '!THE BUILD RESULTS' to the root of the repo with the relevant outputs and results, including screenshots of the errors I'm now getting in Chrome and Firefox.

You can access the GH pages websites here: Before build: https://gordonrudman.github.io/drawio-issue1843-beforeBuild/src/main/webapp/index.html After build: https://gordonrudman.github.io/drawio-issue1843-afterBuild/src/main/webapp/index.html

I see that the website doesn't lock-up like it was doing previously, but the files are still out-of-sync and the errors are still showing the the browser consoles (specifically 'malformed Unicode character escape sequence' in stencils.min.js:143:9). So I'm guessing that its just working by accident at the moment, and the complete lock-ups will return in the future.

Console output.txt Files that were changed during the build process.zip

Errors 1 - Firefox Errors 2 - Chrome

davidjgraph commented 3 years ago

Thanks. What was the build command? What operating system did you build on?

GordonRudman commented 3 years ago

Microsoft Windows 10 Pro Version 10.0.19042 Build 19042

GordonRudman commented 3 years ago

Apache Ant(TM) version 1.10.9 compiled on September 27 2020

java version "1.8.0_281" Java(TM) SE Runtime Environment (build 1.8.0_281-b09) Java HotSpot(TM) 64-Bit Server VM (build 25.281-b09, mixed mode)

GordonRudman commented 3 years ago

C:\drawio\etc\build>ant -file build.xml

Buildfile: C:\drawio\etc\build\build.xml

merge: [java] Processing C:\drawio\src\main\webapp\stencils\android\android.xml... [java] Processing C:\drawio\src\main\webapp\stencils\arrows.xml... [java] Processing C:\drawio\src\main\webapp\stencils\atlassian.xml... [java] Processing C:\drawio\src\main\webapp\stencils\aws\compute.xml... [java] Processing C:\drawio\src\main\webapp\stencils\aws\content_delivery.xml... [java] Processing C:\drawio\src\main\webapp\stencils\aws\database.xml... [java] Processing C:\drawio\src\main\webapp\stencils\aws\deployment_management.xml... [java] Processing C:\drawio\src\main\webapp\stencils\aws\groups.xml... [java] Processing C:\drawio\src\main\webapp\stencils\aws\messaging.xml... [java] Processing C:\drawio\src\main\webapp\stencils\aws\misc.xml... [java] Processing C:\drawio\src\main\webapp\stencils\aws\networking.xml... [java] Processing C:\drawio\src\main\webapp\stencils\aws\non_service_specific.xml... [java] Processing C:\drawio\src\main\webapp\stencils\aws\on_demand_workforce.xml... [java] Processing C:\drawio\src\main\webapp\stencils\aws\storage.xml... [java] Processing C:\drawio\src\main\webapp\stencils\aws2\administration_and_security.xml... [java] Processing C:\drawio\src\main\webapp\stencils\aws2\analytics.xml... [java] Processing C:\drawio\src\main\webapp\stencils\aws2\app_services.xml... [java] Processing C:\drawio\src\main\webapp\stencils\aws2\compute_and_networking.xml... [java] Processing C:\drawio\src\main\webapp\stencils\aws2\database.xml... [java] Processing C:\drawio\src\main\webapp\stencils\aws2\deployment_and_management.xml... [java] Processing C:\drawio\src\main\webapp\stencils\aws2\developer_tools.xml... [java] Processing C:\drawio\src\main\webapp\stencils\aws2\enterprise_applications.xml... [java] Processing C:\drawio\src\main\webapp\stencils\aws2\game_development.xml... [java] Processing C:\drawio\src\main\webapp\stencils\aws2\internet_of_things.xml... [java] Processing C:\drawio\src\main\webapp\stencils\aws2\management_tools.xml... [java] Processing C:\drawio\src\main\webapp\stencils\aws2\mobile_services.xml... [java] Processing C:\drawio\src\main\webapp\stencils\aws2\networking.xml... [java] Processing C:\drawio\src\main\webapp\stencils\aws2\non-service_specific.xml... [java] Processing C:\drawio\src\main\webapp\stencils\aws2\on-demand_workforce.xml... [java] Processing C:\drawio\src\main\webapp\stencils\aws2\sdks.xml... [java] Processing C:\drawio\src\main\webapp\stencils\aws2\security_and_identity.xml... [java] Processing C:\drawio\src\main\webapp\stencils\aws2\storage_and_content_delivery.xml... [java] Processing C:\drawio\src\main\webapp\stencils\aws3.xml... [java] Processing C:\drawio\src\main\webapp\stencils\aws3d.xml... [java] Processing C:\drawio\src\main\webapp\stencils\aws4.xml... [java] Processing C:\drawio\src\main\webapp\stencils\azure.xml... [java] Processing C:\drawio\src\main\webapp\stencils\basic.xml... [java] Processing C:\drawio\src\main\webapp\stencils\bootstrap.xml... [java] Processing C:\drawio\src\main\webapp\stencils\bpmn.xml... [java] Processing C:\drawio\src\main\webapp\stencils\cabinets.xml... [java] Processing C:\drawio\src\main\webapp\stencils\cisco\buildings.xml... [java] Processing C:\drawio\src\main\webapp\stencils\cisco\computers_and_peripherals.xml... [java] Processing C:\drawio\src\main\webapp\stencils\cisco\controllers_and_modules.xml... [java] Processing C:\drawio\src\main\webapp\stencils\cisco\directors.xml... [java] Processing C:\drawio\src\main\webapp\stencils\cisco\hubs_and_gateways.xml... [java] Processing C:\drawio\src\main\webapp\stencils\cisco\misc.xml... [java] Processing C:\drawio\src\main\webapp\stencils\cisco\modems_and_phones.xml... [java] Processing C:\drawio\src\main\webapp\stencils\cisco\people.xml... [java] Processing C:\drawio\src\main\webapp\stencils\cisco\routers.xml... [java] Processing C:\drawio\src\main\webapp\stencils\cisco\security.xml... [java] Processing C:\drawio\src\main\webapp\stencils\cisco\servers.xml... [java] Processing C:\drawio\src\main\webapp\stencils\cisco\storage.xml... [java] Processing C:\drawio\src\main\webapp\stencils\cisco\switches.xml... [java] Processing C:\drawio\src\main\webapp\stencils\cisco\wireless.xml... [java] Processing C:\drawio\src\main\webapp\stencils\cisco19.xml... [java] Processing C:\drawio\src\main\webapp\stencils\cisco_safe\architecture.xml... [java] Processing C:\drawio\src\main\webapp\stencils\cisco_safe\business_icons.xml... [java] Processing C:\drawio\src\main\webapp\stencils\cisco_safe\capability.xml... [java] Processing C:\drawio\src\main\webapp\stencils\cisco_safe\design.xml... [java] Processing C:\drawio\src\main\webapp\stencils\cisco_safe\iot_things_icons.xml... [java] Processing C:\drawio\src\main\webapp\stencils\cisco_safe\people_places_things_icons.xml... [java] Processing C:\drawio\src\main\webapp\stencils\cisco_safe\security_icons.xml... [java] Processing C:\drawio\src\main\webapp\stencils\cisco_safe\technology_icons.xml... [java] Processing C:\drawio\src\main\webapp\stencils\cisco_safe\threat.xml... [java] Processing C:\drawio\src\main\webapp\stencils\citrix.xml... [java] Processing C:\drawio\src\main\webapp\stencils\eip.xml... [java] Processing C:\drawio\src\main\webapp\stencils\electrical\abstract.xml... [java] Processing C:\drawio\src\main\webapp\stencils\electrical\capacitors.xml... [java] Processing C:\drawio\src\main\webapp\stencils\electrical\diodes.xml... [java] Processing C:\drawio\src\main\webapp\stencils\electrical\electro-mechanical.xml... [java] Processing C:\drawio\src\main\webapp\stencils\electrical\iec417.xml... [java] Processing C:\drawio\src\main\webapp\stencils\electrical\iec_logic_gates.xml... [java] Processing C:\drawio\src\main\webapp\stencils\electrical\inductors.xml... [java] Processing C:\drawio\src\main\webapp\stencils\electrical\instruments.xml... [java] Processing C:\drawio\src\main\webapp\stencils\electrical\logic_gates.xml... [java] Processing C:\drawio\src\main\webapp\stencils\electrical\miscellaneous.xml... [java] Processing C:\drawio\src\main\webapp\stencils\electrical\mosfets1.xml... [java] Processing C:\drawio\src\main\webapp\stencils\electrical\mosfets2.xml... [java] Processing C:\drawio\src\main\webapp\stencils\electrical\opto_electronics.xml... [java] Processing C:\drawio\src\main\webapp\stencils\electrical\op_amps.xml... [java] Processing C:\drawio\src\main\webapp\stencils\electrical\plc_ladder.xml... [java] Processing C:\drawio\src\main\webapp\stencils\electrical\power_semiconductors.xml... [java] Processing C:\drawio\src\main\webapp\stencils\electrical\radio.xml... [java] Processing C:\drawio\src\main\webapp\stencils\electrical\resistors.xml... [java] Processing C:\drawio\src\main\webapp\stencils\electrical\rot_mech.xml... [java] Processing C:\drawio\src\main\webapp\stencils\electrical\signal_sources.xml... [java] Processing C:\drawio\src\main\webapp\stencils\electrical\thermionic_devices.xml... [java] Processing C:\drawio\src\main\webapp\stencils\electrical\transistors.xml... [java] Processing C:\drawio\src\main\webapp\stencils\electrical\transmission.xml... [java] Processing C:\drawio\src\main\webapp\stencils\electrical\waveforms.xml... [java] Processing C:\drawio\src\main\webapp\stencils\floorplan.xml... [java] Processing C:\drawio\src\main\webapp\stencils\flowchart.xml... [java] Processing C:\drawio\src\main\webapp\stencils\fluid_power.xml... [java] Processing C:\drawio\src\main\webapp\stencils\gcp\big_data.xml... [java] Processing C:\drawio\src\main\webapp\stencils\gcp\compute.xml... [java] Processing C:\drawio\src\main\webapp\stencils\gcp\developer_tools.xml... [java] Processing C:\drawio\src\main\webapp\stencils\gcp\extras.xml... [java] Processing C:\drawio\src\main\webapp\stencils\gcp\identity_and_security.xml... [java] Processing C:\drawio\src\main\webapp\stencils\gcp\machine_learning.xml... [java] Processing C:\drawio\src\main\webapp\stencils\gcp\management_tools.xml... [java] Processing C:\drawio\src\main\webapp\stencils\gcp\networking.xml... [java] Processing C:\drawio\src\main\webapp\stencils\gcp\product_cards.xml... [java] Processing C:\drawio\src\main\webapp\stencils\gcp\storage_databases.xml... [java] Processing C:\drawio\src\main\webapp\stencils\gcp2.xml... [java] Processing C:\drawio\src\main\webapp\stencils\gmdl.xml... [java] Processing C:\drawio\src\main\webapp\stencils\ibm.xml... [java] Processing C:\drawio\src\main\webapp\stencils\ios7\icons.xml... [java] Processing C:\drawio\src\main\webapp\stencils\ios7\misc.xml... [java] Processing C:\drawio\src\main\webapp\stencils\kubernetes.xml... [java] Processing C:\drawio\src\main\webapp\stencils\lean_mapping.xml... [java] Processing C:\drawio\src\main\webapp\stencils\mockup\advertising.xml... [java] Processing C:\drawio\src\main\webapp\stencils\mockup\calendars.xml... [java] Processing C:\drawio\src\main\webapp\stencils\mockup\carousel.xml... [java] Processing C:\drawio\src\main\webapp\stencils\mockup\charts_and_tables.xml... [java] Processing C:\drawio\src\main\webapp\stencils\mockup\controls.xml... [java] Processing C:\drawio\src\main\webapp\stencils\mockup\form_elements.xml... [java] Processing C:\drawio\src\main\webapp\stencils\mockup\menus_and_buttons.xml... [java] Processing C:\drawio\src\main\webapp\stencils\mockup\misc.xml... [java] Processing C:\drawio\src\main\webapp\stencils\mockup\tabs.xml... [java] Processing C:\drawio\src\main\webapp\stencils\mscae\cloud.xml... [java] Processing C:\drawio\src\main\webapp\stencils\mscae\deprecated.xml... [java] Processing C:\drawio\src\main\webapp\stencils\mscae\enterprise.xml... [java] Processing C:\drawio\src\main\webapp\stencils\mscae\general.xml... [java] Processing C:\drawio\src\main\webapp\stencils\mscae\general_symbols.xml... [java] Processing C:\drawio\src\main\webapp\stencils\mscae\intune.xml... [java] Processing C:\drawio\src\main\webapp\stencils\mscae\oms.xml... [java] Processing C:\drawio\src\main\webapp\stencils\mscae\opsmanager.xml... [java] Processing C:\drawio\src\main\webapp\stencils\mscae\other.xml... [java] Processing C:\drawio\src\main\webapp\stencils\mscae\system_center.xml... [java] Processing C:\drawio\src\main\webapp\stencils\mscae\vm.xml... [java] Processing C:\drawio\src\main\webapp\stencils\networks.xml... [java] Processing C:\drawio\src\main\webapp\stencils\office\clouds.xml... [java] Processing C:\drawio\src\main\webapp\stencils\office\communications.xml... [java] Processing C:\drawio\src\main\webapp\stencils\office\concepts.xml... [java] Processing C:\drawio\src\main\webapp\stencils\office\databases.xml... [java] Processing C:\drawio\src\main\webapp\stencils\office\devices.xml... [java] Processing C:\drawio\src\main\webapp\stencils\office\security.xml... [java] Processing C:\drawio\src\main\webapp\stencils\office\servers.xml... [java] Processing C:\drawio\src\main\webapp\stencils\office\services.xml... [java] Processing C:\drawio\src\main\webapp\stencils\office\sites.xml... [java] Processing C:\drawio\src\main\webapp\stencils\office\users.xml... [java] Processing C:\drawio\src\main\webapp\stencils\pid\agitators.xml... [java] Processing C:\drawio\src\main\webapp\stencils\pid\apparatus_elements.xml... [java] Processing C:\drawio\src\main\webapp\stencils\pid\centrifuges.xml... [java] Processing C:\drawio\src\main\webapp\stencils\pid\compressors.xml... [java] Processing C:\drawio\src\main\webapp\stencils\pid\compressors_iso.xml... [java] Processing C:\drawio\src\main\webapp\stencils\pid\crushers_grinding.xml... [java] Processing C:\drawio\src\main\webapp\stencils\pid\driers.xml... [java] Processing C:\drawio\src\main\webapp\stencils\pid\engines.xml... [java] Processing C:\drawio\src\main\webapp\stencils\pid\feeders.xml... [java] Processing C:\drawio\src\main\webapp\stencils\pid\filters.xml... [java] Processing C:\drawio\src\main\webapp\stencils\pid\fittings.xml... [java] Processing C:\drawio\src\main\webapp\stencils\pid\flow_sensors.xml... [java] Processing C:\drawio\src\main\webapp\stencils\pid\heat_exchangers.xml... [java] Processing C:\drawio\src\main\webapp\stencils\pid\instruments.xml... [java] Processing C:\drawio\src\main\webapp\stencils\pid\misc.xml... [java] Processing C:\drawio\src\main\webapp\stencils\pid\mixers.xml... [java] Processing C:\drawio\src\main\webapp\stencils\pid\piping.xml... [java] Processing C:\drawio\src\main\webapp\stencils\pid\pumps.xml... [java] Processing C:\drawio\src\main\webapp\stencils\pid\pumps_din.xml... [java] Processing C:\drawio\src\main\webapp\stencils\pid\pumps_iso.xml... [java] Processing C:\drawio\src\main\webapp\stencils\pid\separators.xml... [java] Processing C:\drawio\src\main\webapp\stencils\pid\shaping_machines.xml... [java] Processing C:\drawio\src\main\webapp\stencils\pid\valves.xml... [java] Processing C:\drawio\src\main\webapp\stencils\pid\vessels.xml... [java] Processing C:\drawio\src\main\webapp\stencils\rack\apc.xml... [java] Processing C:\drawio\src\main\webapp\stencils\rack\cisco.xml... [java] Processing C:\drawio\src\main\webapp\stencils\rack\dell.xml... [java] Processing C:\drawio\src\main\webapp\stencils\rack\f5.xml... [java] Processing C:\drawio\src\main\webapp\stencils\rack\general.xml... [java] Processing C:\drawio\src\main\webapp\stencils\rack\hp.xml... [java] Processing C:\drawio\src\main\webapp\stencils\rack\hpe_aruba\gateways_controllers.xml... [java] Processing C:\drawio\src\main\webapp\stencils\rack\hpe_aruba\security.xml... [java] Processing C:\drawio\src\main\webapp\stencils\rack\hpe_aruba\switches.xml... [java] Processing C:\drawio\src\main\webapp\stencils\rack\ibm.xml... [java] Processing C:\drawio\src\main\webapp\stencils\rack\oracle.xml... [java] Processing C:\drawio\src\main\webapp\stencils\signs\animals.xml... [java] Processing C:\drawio\src\main\webapp\stencils\signs\food.xml... [java] Processing C:\drawio\src\main\webapp\stencils\signs\healthcare.xml... [java] Processing C:\drawio\src\main\webapp\stencils\signs\nature.xml... [java] Processing C:\drawio\src\main\webapp\stencils\signs\people.xml... [java] Processing C:\drawio\src\main\webapp\stencils\signs\safety.xml... [java] Processing C:\drawio\src\main\webapp\stencils\signs\science.xml... [java] Processing C:\drawio\src\main\webapp\stencils\signs\sports.xml... [java] Processing C:\drawio\src\main\webapp\stencils\signs\tech.xml... [java] Processing C:\drawio\src\main\webapp\stencils\signs\transportation.xml... [java] Processing C:\drawio\src\main\webapp\stencils\signs\travel.xml... [java] Processing C:\drawio\src\main\webapp\stencils\sitemap.xml... [java] Processing C:\drawio\src\main\webapp\stencils\veeam\2d.xml... [java] Processing C:\drawio\src\main\webapp\stencils\veeam\3d.xml... [java] Processing C:\drawio\src\main\webapp\stencils\veeam\veeam.xml... [java] Processing C:\drawio\src\main\webapp\stencils\veeam\veeam2.xml... [java] Processing C:\drawio\src\main\webapp\stencils\vvd.xml... [java] Processing C:\drawio\src\main\webapp\stencils\webicons.xml... [java] Processing C:\drawio\src\main\webapp\stencils\weblogos.xml... [jscomp] Compiling 1 file(s) with 65 extern(s) [jscomp] 0 error(s), 0 warning(s) [delete] Deleting directory C:\drawio\build

app: [copy] Copying 1 file to C:\drawio\etc\build [copy] Copying 1 file to C:\drawio\etc\build [copy] Copying 1 file to C:\drawio\etc\build [jscomp] Compiling 10 file(s) with 65 extern(s) [jscomp] 0 error(s), 0 warning(s) [jscomp] Compiling 57 file(s) with 65 extern(s) [jscomp] 0 error(s), 0 warning(s) [jscomp] Compiling 5 file(s) with 65 extern(s) [jscomp] 0 error(s), 0 warning(s) [jscomp] Compiling 1 file(s) with 65 extern(s) [jscomp] 0 error(s), 0 warning(s) [jscomp] Compiling 17 file(s) with 65 extern(s) [jscomp] 0 error(s), 0 warning(s) [jscomp] Compiling 1 file(s) with 65 extern(s) [jscomp] 0 error(s), 0 warning(s) [delete] Deleting: C:\drawio\src\main\webapp\js\extensions.min.js [delete] Deleting: C:\drawio\etc\build.tmp0.js [delete] Deleting: C:\drawio\etc\build.tmp0.min.js [delete] Deleting: C:\drawio\etc\build.tmp1.js [delete] Deleting: C:\drawio\etc\build.tmp2.js [delete] Deleting: C:\drawio\etc\build.tmp2.min.js [delete] Deleting: C:\drawio\etc\build.tmp3.js [delete] Deleting: C:\drawio\etc\build.tmp1.xml [delete] Deleting: C:\drawio\etc\build.tmp2.xml [jscomp] Compiling 26 file(s) with 65 extern(s) [jscomp] 0 error(s), 0 warning(s) [jscomp] Compiling 6 file(s) with 65 extern(s) [jscomp] 0 error(s), 0 warning(s) [delete] Deleting: C:\drawio\src\main\webapp\js\orgchart.min.js [jscomp] Compiling 1 file(s) with 65 extern(s) [jscomp] 0 error(s), 0 warning(s) [delete] Deleting: C:\drawio\etc\build.tmp3.js [delete] Deleting: C:\drawio\etc\build.tmp1.js [jscomp] Compiling 48 file(s) with 65 extern(s) [jscomp] 0 error(s), 0 warning(s) [delete] Deleting: C:\drawio\etc\build\Graph-Stylesheet.js [delete] Deleting: C:\drawio\etc\build\Graph-Resources.js [delete] Deleting: C:\drawio\etc\build\grapheditor.min.js [delete] Deleting: C:\drawio\etc\build\sidebar.min.js [delete] Deleting: C:\drawio\etc\build\client.min.js [delete] Deleting: C:\drawio\etc\build.tmp1.js

all:

BUILD SUCCESSFUL Total time: 1 minute 29 seconds

[Edited to shorten paths to make it easier to read. Original console output attached]

GordonRudman commented 3 years ago

I'm not sure if this helps, but if I run the build command a second time I get the same output, so there isn't anything new to commit to the repo. Just seems to be out-of-sync that first time round

davidjgraph commented 3 years ago

I can't repeat this. I suspect you have a character encoding issue somewhere in the process.

Constaline commented 2 years ago

@GordonRudman this problem is about file encoding?

Patronud commented 1 year ago

Regarding point 8. Unfortunately these new files cause the website to fail to load, with errors regarding unicode encoding in stencils.min.js. I ran into the stencils.min.js problem yesterday and I am guessing this has something to do with the operating system settings somehow, since not everyone encounters it.

Recap: The error comes when Xml2Js compiles using \ for paths instead of /, users.xml (src\main\webapp\stencils\office\users.xml) is compiled into stencils.min.js (src\main\webapp\js\stencils.min.js), this creates f['office\users.xml'] which gives the error due to the \u being the start of a unicode character.

Here is my current solution, which may not be the correct solution: in Xml2Js.java >public List walk(File base, File root) throws IOException String name = f.getCanonicalPath() .substring(basePath.length() + 1); // Added >>> name = name.replace("\", "/"); // <<< Added result.add( "f['" + name + "'] = '" + processFile(f) + "';\n");

running javac Xml2Js.java afterwards to build the .class file.

I know I am really late to the party, but maybe it can help someone @GordonRudman, @davidjgraph