TruTruMaster commented on PR #1601:
URL: https://github.com/apache/poi/pull/1601#issuecomment-7240566652

   Thanks for the careful review, you were right on all points. Reworked in 
7290bc0:
   
   - **Other click actions:** `XSLFHyperlink.copy` no longer goes through 
`getType()`. It works from the source relation instead:
     - a link without a relation id (`ppaction://media`, macros, `noaction`, 
relative jumps, an empty id) keeps the copied XML as it is;
     - an external relation is recreated with the same relationship type and 
target, and the action is kept (`hlinkfile`, `hlinkpres`);
     - a link to a slide gets a relation to that slide, as before.
     Nothing goes through `addExternalRelationship(getAddress())` any more, so 
a macro name with a space can't fail the import.
   - **No target:** when the source relation can't be resolved, the id stays 
empty and the action is removed with a warning, so no slide jump without a 
target is left. This also covers the `DOCUMENT` case you pointed out in the 
text run path.
   - **`cNvPr`:** `getHyperlink()` returns null when the shape has no `cNvPr`.
   - **Round trip:** `testImportContentKeepsShapeHyperlinks` now writes `dst` 
and reads it back. The target deck has a second slide, so the slide link 
resolves to a real part, and the links are checked after the read too.
   
   New tests: `testImportContentKeepsShapeActionsWithoutRelation` 
(parameterized: `ppaction://media`, a macro with a space in its name, 
`ppaction://noaction`, an empty id), `testImportContentKeepsFileLinkAction` and 
`testImportContentWithDanglingShapeHyperlink`. On the previous head 6 of these 
cases failed as you described: an extra relation for the media/noaction/empty 
links, `URISyntaxException` for the macro, the lost `hlinkfile` action, and the 
dangling jump. All 284 `org.apache.poi.xslf` tests pass.
   
   I left `hlinkHover`, and `hlinkClick` on group shapes and graphic frames, 
for a follow-up.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to