Opened 9 years ago
Closed 7 years ago
#15561 closed defect (fixed)
[patch][cla] Reg Exp for the path is incorrect causing render to not work as expected
Reported by: | j105rob | Owned by: | Eric Durocher |
---|---|---|---|
Priority: | high | Milestone: | 1.10 |
Component: | DojoX GFX | Version: | 1.7.1 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
pathSvgRegExp variable defined as /([A-Za-z])|(\d+(\.\d+)?)|(\.\d+)|(-\d+(\.\d+)?)|(-\.\d+)/g
does not correctly parse the path; should a segment of a path be defined in scientific notation (e.g. -6e-9) the result of the regex does not pass the correct information into the shape object and causes the render to render the image incorrectly;
We modified the regex to: /(\d+(\.\d+)?[Ee]-\d+)|(-\d+(\.\d+)?[Ee]-\d+)|([A-Za-z])|(\d+(\.\d+)?)|(\.\d+)|(-\d+(\.\d+)?)|(-\.\d+)/g
which allowed the expected data to be passed to the renderer and rendered the image as expected.
I am not submitting a patch file because we have other changes we need to submit, but this is a bug which can be fixed in the short term.
Thanks, j105Rob.
Change History (6)
comment:1 Changed 8 years ago by
comment:2 Changed 8 years ago by
Milestone: | tbd → 1.9 |
---|---|
Priority: | undecided → high |
Summary: | Reg Exp for the path is incorrect causing render to not work as expected → [patch][cla] Reg Exp for the path is incorrect causing render to not work as expected |
Verified that both j105b and Thomas have CLAs on file.
We should fix this for 1.9.
comment:3 Changed 8 years ago by
Milestone: | 1.9 → 1.10 |
---|
Bumping this ticket since we are past the deadline for the 1.9RC. The fix can be put into 1.9.1 too, if desired.
comment:4 Changed 7 years ago by
Looks trivial enough, and follows the standard. Should be committed.
comment:5 Changed 7 years ago by
Owner: | changed from Eugene Lazutkin to Eric Durocher |
---|---|
Status: | new → assigned |
comment:6 Changed 7 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Fixed in master: https://github.com/dojo/dojox/commit/f4a8237b8301c0db7b49a316161f5bcbbfcdb39c Backported to 1.9: https://github.com/dojo/dojox/commit/4c56405f00667ce463d1edb815d31a4a1900673c
Thanks j105rob and Thomas L. Shinnick.
Per Thomas L. Shinnick on the mailing list:
As described above. Still broken in 1.8.3. Here's what I was going to submit before finding this report:
Dojox/gfx::createPath fails on numbers with exponents
Working with path strings as output to SVG files by popular external program "Inkscape". These path strings often contain a full range of number value formats, including numbers with exponents.
The number format for path data in SVG is documented
The format is described as
To split up incoming path strings into actions and arguments
uses a regex published as
This regex does not recognize number exponents and so the parsed path string has scattered 'E' and/or 'e' "actions" leftover. This causes paths to not be displayed, presumably because of the invalid actions.
Fix is to recognize numbers that include exponents.
Note that this regex reflects the number formats in SVG specs. There is one format that is not permitted there -- "9." -- an integer followed by a decimal point *not* followed by other digits. A more permissive regex might be more bulletproof.
I have not yet looked at modifications to tests to prove the failing.
Edit: since the bug database had errors preventing my comment a couple days ago, I looked at the tests. These modifications show the problem and the fix: