diff options
author | Justin Clarke Casey | 2008-08-26 18:14:10 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-08-26 18:14:10 +0000 |
commit | f0448e299d4ef970ad9789f1df2811f54f0513f8 (patch) | |
tree | b8d6dd2d6814902251e737dd88932a09b2ebc5e7 | |
parent | * One more tweak to the application/xml vs application/llsd+xml routine (diff) | |
download | opensim-SC-f0448e299d4ef970ad9789f1df2811f54f0513f8.zip opensim-SC-f0448e299d4ef970ad9789f1df2811f54f0513f8.tar.gz opensim-SC-f0448e299d4ef970ad9789f1df2811f54f0513f8.tar.bz2 opensim-SC-f0448e299d4ef970ad9789f1df2811f54f0513f8.tar.xz |
* On loading archives, report an error if an asset does not have the expected filename format
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/Archiver/ArchiveConstants.cs | 93 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs | 13 |
2 files changed, 61 insertions, 45 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveConstants.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveConstants.cs index a76ff0d..5e22e57 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveConstants.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveConstants.cs | |||
@@ -59,6 +59,11 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
59 | /// Path for terrains. Technically these may be assets, but I think it's quite nice to split them out. | 59 | /// Path for terrains. Technically these may be assets, but I think it's quite nice to split them out. |
60 | /// </summary> | 60 | /// </summary> |
61 | public static readonly string TERRAINS_PATH = "terrains/"; | 61 | public static readonly string TERRAINS_PATH = "terrains/"; |
62 | |||
63 | /// <summary> | ||
64 | /// The character the separates the uuid from extension information in an archived asset filename | ||
65 | /// </summary> | ||
66 | public static readonly string ASSET_EXTENSION_SEPARATOR = "_"; | ||
62 | 67 | ||
63 | /// <summary> | 68 | /// <summary> |
64 | /// Extensions used for asset types in the archive | 69 | /// Extensions used for asset types in the archive |
@@ -68,59 +73,59 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
68 | 73 | ||
69 | static ArchiveConstants() | 74 | static ArchiveConstants() |
70 | { | 75 | { |
71 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Animation] = "_animation.bvh"; | 76 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Animation] = ASSET_EXTENSION_SEPARATOR + "animation.bvh"; |
72 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Bodypart] = "_bodypart.txt"; | 77 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Bodypart] = ASSET_EXTENSION_SEPARATOR + "bodypart.txt"; |
73 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.CallingCard] = "_callingcard.txt"; | 78 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.CallingCard] = ASSET_EXTENSION_SEPARATOR + "callingcard.txt"; |
74 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Clothing] = "_clothing.txt"; | 79 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Clothing] = ASSET_EXTENSION_SEPARATOR + "clothing.txt"; |
75 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Folder] = "_folder.txt"; // Not sure if we'll ever see this | 80 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Folder] = ASSET_EXTENSION_SEPARATOR + "folder.txt"; // Not sure if we'll ever see this |
76 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Gesture] = "_gesture.txt"; | 81 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Gesture] = ASSET_EXTENSION_SEPARATOR + "gesture.txt"; |
77 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.ImageJPEG] = "_image.jpg"; | 82 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.ImageJPEG] = ASSET_EXTENSION_SEPARATOR + "image.jpg"; |
78 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.ImageTGA] = "_image.tga"; | 83 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.ImageTGA] = ASSET_EXTENSION_SEPARATOR + "image.tga"; |
79 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LostAndFoundFolder] = "_lostandfoundfolder.txt"; // Not sure if we'll ever see this | 84 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LostAndFoundFolder] = ASSET_EXTENSION_SEPARATOR + "lostandfoundfolder.txt"; // Not sure if we'll ever see this |
80 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LSLBytecode] = "_bytecode.lso"; | 85 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LSLBytecode] = ASSET_EXTENSION_SEPARATOR + "bytecode.lso"; |
81 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LSLText] = "_script.lsl"; | 86 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LSLText] = ASSET_EXTENSION_SEPARATOR + "script.lsl"; |
82 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Notecard] = "_notecard.txt"; | 87 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Notecard] = ASSET_EXTENSION_SEPARATOR + "notecard.txt"; |
83 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Object] = "_object.xml"; | 88 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Object] = ASSET_EXTENSION_SEPARATOR + "object.xml"; |
84 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.RootFolder] = "_rootfolder.txt"; // Not sure if we'll ever see this | 89 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.RootFolder] = ASSET_EXTENSION_SEPARATOR + "rootfolder.txt"; // Not sure if we'll ever see this |
85 | // disable warning: we know Script is obsolete, but need to support it | 90 | // disable warning: we know Script is obsolete, but need to support it |
86 | // anyhow | 91 | // anyhow |
87 | #pragma warning disable 0612 | 92 | #pragma warning disable 0612 |
88 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Script] = "_script.txt"; // Not sure if we'll ever see this | 93 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Script] = ASSET_EXTENSION_SEPARATOR + "script.txt"; // Not sure if we'll ever see this |
89 | #pragma warning restore 0612 | 94 | #pragma warning restore 0612 |
90 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Simstate] = "_simstate.bin"; // Not sure if we'll ever see this | 95 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Simstate] = ASSET_EXTENSION_SEPARATOR + "simstate.bin"; // Not sure if we'll ever see this |
91 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.SnapshotFolder] = "_snapshotfolder.txt"; // Not sure if we'll ever see this | 96 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.SnapshotFolder] = ASSET_EXTENSION_SEPARATOR + "snapshotfolder.txt"; // Not sure if we'll ever see this |
92 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Sound] = "_sound.ogg"; | 97 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Sound] = ASSET_EXTENSION_SEPARATOR + "sound.ogg"; |
93 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.SoundWAV] = "_sound.wav"; | 98 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.SoundWAV] = ASSET_EXTENSION_SEPARATOR + "sound.wav"; |
94 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Texture] = "_texture.jp2"; | 99 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Texture] = ASSET_EXTENSION_SEPARATOR + "texture.jp2"; |
95 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.TextureTGA] = "_texture.tga"; | 100 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.TextureTGA] = ASSET_EXTENSION_SEPARATOR + "texture.tga"; |
96 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.TrashFolder] = "_trashfolder.txt"; // Not sure if we'll ever see this | 101 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.TrashFolder] = ASSET_EXTENSION_SEPARATOR + "trashfolder.txt"; // Not sure if we'll ever see this |
97 | 102 | ||
98 | EXTENSION_TO_ASSET_TYPE["_animation.bvh"] = (sbyte)AssetType.Animation; | 103 | EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "animation.bvh"] = (sbyte)AssetType.Animation; |
99 | EXTENSION_TO_ASSET_TYPE["_bodypart.txt"] = (sbyte)AssetType.Bodypart; | 104 | EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "bodypart.txt"] = (sbyte)AssetType.Bodypart; |
100 | EXTENSION_TO_ASSET_TYPE["_callingcard.txt"] = (sbyte)AssetType.CallingCard; | 105 | EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "callingcard.txt"] = (sbyte)AssetType.CallingCard; |
101 | EXTENSION_TO_ASSET_TYPE["_clothing.txt"] = (sbyte)AssetType.Clothing; | 106 | EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "clothing.txt"] = (sbyte)AssetType.Clothing; |
102 | EXTENSION_TO_ASSET_TYPE["_folder.txt"] = (sbyte)AssetType.Folder; | 107 | EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "folder.txt"] = (sbyte)AssetType.Folder; |
103 | EXTENSION_TO_ASSET_TYPE["_gesture.txt"] = (sbyte)AssetType.Gesture; | 108 | EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "gesture.txt"] = (sbyte)AssetType.Gesture; |
104 | EXTENSION_TO_ASSET_TYPE["_image.jpg"] = (sbyte)AssetType.ImageJPEG; | 109 | EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "image.jpg"] = (sbyte)AssetType.ImageJPEG; |
105 | EXTENSION_TO_ASSET_TYPE["_image.tga"] = (sbyte)AssetType.ImageTGA; | 110 | EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "image.tga"] = (sbyte)AssetType.ImageTGA; |
106 | EXTENSION_TO_ASSET_TYPE["_lostandfoundfolder.txt"] = (sbyte)AssetType.LostAndFoundFolder; | 111 | EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "lostandfoundfolder.txt"] = (sbyte)AssetType.LostAndFoundFolder; |
107 | EXTENSION_TO_ASSET_TYPE["_bytecode.lso"] = (sbyte)AssetType.LSLBytecode; | 112 | EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "bytecode.lso"] = (sbyte)AssetType.LSLBytecode; |
108 | EXTENSION_TO_ASSET_TYPE["_script.lsl"] = (sbyte)AssetType.LSLText; | 113 | EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "script.lsl"] = (sbyte)AssetType.LSLText; |
109 | EXTENSION_TO_ASSET_TYPE["_notecard.txt"] = (sbyte)AssetType.Notecard; | 114 | EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "notecard.txt"] = (sbyte)AssetType.Notecard; |
110 | EXTENSION_TO_ASSET_TYPE["_object.xml"] = (sbyte)AssetType.Object; | 115 | EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "object.xml"] = (sbyte)AssetType.Object; |
111 | EXTENSION_TO_ASSET_TYPE["_rootfolder.txt"] = (sbyte)AssetType.RootFolder; | 116 | EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "rootfolder.txt"] = (sbyte)AssetType.RootFolder; |
112 | // disable warning: we know Script is obsolete, but need to support it | 117 | // disable warning: we know Script is obsolete, but need to support it |
113 | // anyhow | 118 | // anyhow |
114 | #pragma warning disable 0612 | 119 | #pragma warning disable 0612 |
115 | EXTENSION_TO_ASSET_TYPE["_script.txt"] = (sbyte)AssetType.Script; | 120 | EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "script.txt"] = (sbyte)AssetType.Script; |
116 | #pragma warning restore 0612 | 121 | #pragma warning restore 0612 |
117 | EXTENSION_TO_ASSET_TYPE["_simstate.bin"] = (sbyte)AssetType.Simstate; | 122 | EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "simstate.bin"] = (sbyte)AssetType.Simstate; |
118 | EXTENSION_TO_ASSET_TYPE["_snapshotfolder.txt"] = (sbyte)AssetType.SnapshotFolder; | 123 | EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "snapshotfolder.txt"] = (sbyte)AssetType.SnapshotFolder; |
119 | EXTENSION_TO_ASSET_TYPE["_sound.ogg"] = (sbyte)AssetType.Sound; | 124 | EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "sound.ogg"] = (sbyte)AssetType.Sound; |
120 | EXTENSION_TO_ASSET_TYPE["_sound.wav"] = (sbyte)AssetType.SoundWAV; | 125 | EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "sound.wav"] = (sbyte)AssetType.SoundWAV; |
121 | EXTENSION_TO_ASSET_TYPE["_texture.jp2"] = (sbyte)AssetType.Texture; | 126 | EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "texture.jp2"] = (sbyte)AssetType.Texture; |
122 | EXTENSION_TO_ASSET_TYPE["_texture.tga"] = (sbyte)AssetType.TextureTGA; | 127 | EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "texture.tga"] = (sbyte)AssetType.TextureTGA; |
123 | EXTENSION_TO_ASSET_TYPE["_trashfolder.txt"] = (sbyte)AssetType.TrashFolder; | 128 | EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "trashfolder.txt"] = (sbyte)AssetType.TrashFolder; |
124 | } | 129 | } |
125 | } | 130 | } |
126 | } | 131 | } |
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs index 87106fb..201986e 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -211,7 +211,18 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
211 | { | 211 | { |
212 | // Right now we're nastily obtaining the lluuid from the filename | 212 | // Right now we're nastily obtaining the lluuid from the filename |
213 | string filename = assetPath.Remove(0, ArchiveConstants.ASSETS_PATH.Length); | 213 | string filename = assetPath.Remove(0, ArchiveConstants.ASSETS_PATH.Length); |
214 | string extension = filename.Substring(filename.LastIndexOf("_")); | 214 | int i = filename.LastIndexOf(ArchiveConstants.ASSET_EXTENSION_SEPARATOR); |
215 | |||
216 | if (i == -1) | ||
217 | { | ||
218 | m_log.ErrorFormat( | ||
219 | "[ARCHIVER]: Could not find extension information in asset path {0} since it's missing the separator {1}. Skipping", | ||
220 | assetPath, ArchiveConstants.ASSET_EXTENSION_SEPARATOR); | ||
221 | |||
222 | return false; | ||
223 | } | ||
224 | |||
225 | string extension = filename.Substring(i); | ||
215 | string uuid = filename.Remove(filename.Length - extension.Length); | 226 | string uuid = filename.Remove(filename.Length - extension.Length); |
216 | 227 | ||
217 | if (ArchiveConstants.EXTENSION_TO_ASSET_TYPE.ContainsKey(extension)) | 228 | if (ArchiveConstants.EXTENSION_TO_ASSET_TYPE.ContainsKey(extension)) |