| 80 | 80 | final var attrs = node.getAttributes(); |
| 81 | 81 | |
| 82 | | if( attrs != null ) { |
| 83 | | final var attr = attrs.getNamedItem( "src" ); |
| 82 | final var attr = attrs.getNamedItem( "src" ); |
| 84 | 83 | |
| 85 | | if( attr != null ) { |
| 86 | | final var imageFile = exportImage( attr.getTextContent() ); |
| 84 | if( attr != null ) { |
| 85 | final var imageFile = exportImage( attr.getTextContent() ); |
| 87 | 86 | |
| 88 | | attr.setTextContent( imageFile.toString() ); |
| 89 | | } |
| 87 | attr.setTextContent( imageFile.toString() ); |
| 90 | 88 | } |
| 91 | 89 | } catch( final Exception ex ) { |
| ... |
| 169 | 167 | // Download remote resources into temporary files. |
| 170 | 168 | if( protocol.isRemote() ) { |
| 171 | | final var response = httpGet( src ); |
| 172 | | final var mediaType = response.getMediaType(); |
| 169 | try( final var response = httpGet( src ) ) { |
| 170 | final var mediaType = response.getMediaType(); |
| 173 | 171 | |
| 174 | | imageFile = mediaType.createTemporaryFile( APP_TITLE_LOWERCASE ); |
| 172 | imageFile = mediaType.createTemporaryFile( APP_TITLE_LOWERCASE ); |
| 175 | 173 | |
| 176 | | try( final var image = response.getInputStream() ) { |
| 177 | | copy( image, imageFile, REPLACE_EXISTING ); |
| 178 | | } |
| 174 | try( final var image = response.getInputStream() ) { |
| 175 | copy( image, imageFile, REPLACE_EXISTING ); |
| 176 | } |
| 179 | 177 | |
| 180 | | // Strip comments, superfluous whitespace, DOCTYPE, and XML declarations. |
| 181 | | if( mediaType.isSvg() ) { |
| 182 | | DocumentParser.sanitize( imageFile ); |
| 178 | // Strip comments, superfluous whitespace, DOCTYPE, and XML |
| 179 | // declarations. |
| 180 | if( mediaType.isSvg() ) { |
| 181 | DocumentParser.sanitize( imageFile ); |
| 182 | } |
| 183 | 183 | } |
| 184 | 184 | } |