diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index a3ec419..2b1c552 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -423,15 +423,15 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
423 | /// </summary> | 423 | /// </summary> |
424 | private Stream GetStream(string path) | 424 | private Stream GetStream(string path) |
425 | { | 425 | { |
426 | try | 426 | if (File.Exists(path)) |
427 | { | 427 | { |
428 | if (File.Exists(path)) | 428 | return new FileStream(path, FileMode.Open, FileAccess.Read); |
429 | { | 429 | } |
430 | return new FileStream(path, FileMode.Open, FileAccess.Read); | 430 | else |
431 | } | 431 | { |
432 | else | 432 | try |
433 | { | 433 | { |
434 | Uri uri = new Uri(path); // throw exception if not valid URI | 434 | Uri uri = new Uri(path); |
435 | if (uri.Scheme == "file") | 435 | if (uri.Scheme == "file") |
436 | { | 436 | { |
437 | return new FileStream(uri.AbsolutePath, FileMode.Open, FileAccess.Read); | 437 | return new FileStream(uri.AbsolutePath, FileMode.Open, FileAccess.Read); |
@@ -446,16 +446,18 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
446 | return URIFetch(uri); | 446 | return URIFetch(uri); |
447 | } | 447 | } |
448 | } | 448 | } |
449 | } | 449 | catch (UriFormatException) |
450 | catch (Exception e) | 450 | { |
451 | { | 451 | // In many cases the user will put in a plain old filename that cannot be found so assume that |
452 | throw new Exception(String.Format("Unable to create file input stream for {0}: {1}", path, e.Message)); | 452 | // this is the problem rather than confusing the issue with a UriFormatException |
453 | throw new Exception(String.Format("Cannot find file {0}", path)); | ||
454 | } | ||
453 | } | 455 | } |
454 | } | 456 | } |
455 | 457 | ||
456 | private static Stream URIFetch(Uri uri) | 458 | private static Stream URIFetch(Uri uri) |
457 | { | 459 | { |
458 | HttpWebRequest request = (HttpWebRequest) WebRequest.Create(uri); | 460 | HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); |
459 | 461 | ||
460 | // request.Credentials = credentials; | 462 | // request.Credentials = credentials; |
461 | 463 | ||