4949import java .io .InputStream ;
5050import java .io .Writer ;
5151import java .net .URI ;
52+ import java .net .URISyntaxException ;
5253import java .util .List ;
5354import java .util .Map ;
5455import java .util .Set ;
@@ -247,15 +248,26 @@ protected String getFileName(RenderContext ctx, Object value)
247248 return getFileName (ctx , value , false );
248249 }
249250
251+ @ Override
250252 protected String getFileName (RenderContext ctx , Object value , boolean isDisplay )
251253 {
252254 String result = value == null ? null : StringUtils .trimToNull (value .toString ());
253255 if (result != null )
254256 {
255- File f ;
257+ File f = null ;
256258 if (result .startsWith ("file:" ))
257- f = new File (URI .create (result ));
258- else
259+ {
260+ try
261+ {
262+ f = new File (new URI (result ));
263+ }
264+ catch (URISyntaxException x )
265+ {
266+ // try to recover
267+ result = result .substring ("file:" .length ());
268+ }
269+ }
270+ if (null == f )
259271 f = FileUtil .getAbsoluteCaseSensitiveFile (new File (result ));
260272 NetworkDrive .ensureDrive (f .getPath ());
261273 List <FileContentService .ContentType > fileRootTypes = List .of (FileContentService .ContentType .files , FileContentService .ContentType .pipeline , FileContentService .ContentType .assayfiles );
@@ -270,7 +282,7 @@ protected String getFileName(RenderContext ctx, Object value, boolean isDisplay)
270282 result = f .getName ();
271283 }
272284
273- if (isDisplay && !f .exists ())
285+ if (isDisplay && !f .exists () && ! result . endsWith ( "(unavailable)" ) )
274286 result += " (unavailable)" ;
275287 }
276288 return result ;
@@ -339,7 +351,7 @@ else if (f.isDirectory())
339351 else
340352 {
341353 // It's not on the file system anymore, so don't offer a link and tell the user it's unavailable
342- super .renderIconAndFilename (ctx , out , filename + " (unavailable)" , Attachment .getFileIcon (filename ), null , false , false );
354+ super .renderIconAndFilename (ctx , out , filename , Attachment .getFileIcon (filename ), null , false , false );
343355 }
344356 }
345357 else
0 commit comments