From 041fcd6a72e1822656d58f87a398e3a0f065a486 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 6 Sep 2012 17:18:34 +0100 Subject: remove extra '/' in assets url --- .../Connectors/Asset/AssetServicesConnector.cs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'OpenSim/Services') diff --git a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs index 45ebf3a..7ad6f0b 100644 --- a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs +++ b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs @@ -181,7 +181,8 @@ namespace OpenSim.Services.Connectors public AssetBase Get(string id) { - string uri = MapServer(id) + "/assets/" + id; +// string uri = MapServer(id) + "/assets/" + id; + string uri = MapServer(id) + "assets/" + id; AssetBase asset = null; if (m_Cache != null) @@ -218,7 +219,8 @@ namespace OpenSim.Services.Connectors return fullAsset.Metadata; } - string uri = MapServer(id) + "/assets/" + id + "/metadata"; +// string uri = MapServer(id) + "/assets/" + id + "/metadata"; + string uri = MapServer(id) + "assets/" + id + "/metadata"; AssetMetadata asset = SynchronousRestObjectRequester. MakeRequest("GET", uri, 0); @@ -260,7 +262,8 @@ namespace OpenSim.Services.Connectors public bool Get(string id, Object sender, AssetRetrieved handler) { - string uri = MapServer(id) + "/assets/" + id; +// string uri = MapServer(id) + "/assets/" + id; + string uri = MapServer(id) + "assets/" + id; AssetBase asset = null; if (m_Cache != null) @@ -379,7 +382,9 @@ namespace OpenSim.Services.Connectors return asset.ID; } - string uri = MapServer(asset.FullID.ToString()) + "/assets/"; +// string uri = MapServer(asset.FullID.ToString()) + "/assets/"; + + string uri = MapServer(asset.FullID.ToString()) + "assets/"; string newID = string.Empty; try @@ -456,7 +461,8 @@ namespace OpenSim.Services.Connectors } asset.Data = data; - string uri = MapServer(id) + "/assets/" + id; +// string uri = MapServer(id) + "/assets/" + id; + string uri = MapServer(id) + "assets/" + id; if (SynchronousRestObjectRequester. MakeRequest("POST", uri, asset)) @@ -471,7 +477,8 @@ namespace OpenSim.Services.Connectors public bool Delete(string id) { - string uri = MapServer(id) + "/assets/" + id; +// string uri = MapServer(id) + "/assets/" + id; + string uri = MapServer(id) + "assets/" + id; if (SynchronousRestObjectRequester. MakeRequest("DELETE", uri, 0)) -- cgit v1.1 From 27d345c9a0047af44296184557aed25719b2759e Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 6 Sep 2012 17:02:55 +0200 Subject: Revert " remove extra '/' in assets url" This reverts commit 041fcd6a72e1822656d58f87a398e3a0f065a486. --- .../Connectors/Asset/AssetServicesConnector.cs | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'OpenSim/Services') diff --git a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs index 7ad6f0b..45ebf3a 100644 --- a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs +++ b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs @@ -181,8 +181,7 @@ namespace OpenSim.Services.Connectors public AssetBase Get(string id) { -// string uri = MapServer(id) + "/assets/" + id; - string uri = MapServer(id) + "assets/" + id; + string uri = MapServer(id) + "/assets/" + id; AssetBase asset = null; if (m_Cache != null) @@ -219,8 +218,7 @@ namespace OpenSim.Services.Connectors return fullAsset.Metadata; } -// string uri = MapServer(id) + "/assets/" + id + "/metadata"; - string uri = MapServer(id) + "assets/" + id + "/metadata"; + string uri = MapServer(id) + "/assets/" + id + "/metadata"; AssetMetadata asset = SynchronousRestObjectRequester. MakeRequest("GET", uri, 0); @@ -262,8 +260,7 @@ namespace OpenSim.Services.Connectors public bool Get(string id, Object sender, AssetRetrieved handler) { -// string uri = MapServer(id) + "/assets/" + id; - string uri = MapServer(id) + "assets/" + id; + string uri = MapServer(id) + "/assets/" + id; AssetBase asset = null; if (m_Cache != null) @@ -382,9 +379,7 @@ namespace OpenSim.Services.Connectors return asset.ID; } -// string uri = MapServer(asset.FullID.ToString()) + "/assets/"; - - string uri = MapServer(asset.FullID.ToString()) + "assets/"; + string uri = MapServer(asset.FullID.ToString()) + "/assets/"; string newID = string.Empty; try @@ -461,8 +456,7 @@ namespace OpenSim.Services.Connectors } asset.Data = data; -// string uri = MapServer(id) + "/assets/" + id; - string uri = MapServer(id) + "assets/" + id; + string uri = MapServer(id) + "/assets/" + id; if (SynchronousRestObjectRequester. MakeRequest("POST", uri, asset)) @@ -477,8 +471,7 @@ namespace OpenSim.Services.Connectors public bool Delete(string id) { -// string uri = MapServer(id) + "/assets/" + id; - string uri = MapServer(id) + "assets/" + id; + string uri = MapServer(id) + "/assets/" + id; if (SynchronousRestObjectRequester. MakeRequest("DELETE", uri, 0)) -- cgit v1.1 From b9d026666dbabb210cc013d29eb79fe214594dd9 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 6 Sep 2012 17:11:44 +0200 Subject: Change string concatenation to Path.Combine to eliminate extra slashes. Windoze barfs on them. --- .../Services/Connectors/Asset/AssetServicesConnector.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'OpenSim/Services') diff --git a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs index 45ebf3a..2a3dacc 100644 --- a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs +++ b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs @@ -181,7 +181,7 @@ namespace OpenSim.Services.Connectors public AssetBase Get(string id) { - string uri = MapServer(id) + "/assets/" + id; + string uri = Path.Combine(MapServer(id), Path.Combine("assets", id)); AssetBase asset = null; if (m_Cache != null) @@ -218,7 +218,7 @@ namespace OpenSim.Services.Connectors return fullAsset.Metadata; } - string uri = MapServer(id) + "/assets/" + id + "/metadata"; + string uri = Path.Combine(MapServer(id), Path.Combine("assets", id)); AssetMetadata asset = SynchronousRestObjectRequester. MakeRequest("GET", uri, 0); @@ -260,7 +260,7 @@ namespace OpenSim.Services.Connectors public bool Get(string id, Object sender, AssetRetrieved handler) { - string uri = MapServer(id) + "/assets/" + id; + string uri = Path.Combine(MapServer(id), Path.Combine("assets", id)); AssetBase asset = null; if (m_Cache != null) @@ -379,7 +379,9 @@ namespace OpenSim.Services.Connectors return asset.ID; } - string uri = MapServer(asset.FullID.ToString()) + "/assets/"; + string uri = Path.Combine(MapServer(asset.FullID.ToString()), "/assets/"); + if (!uri.EndsWith("/")) + uri += "/"; string newID = string.Empty; try @@ -456,7 +458,7 @@ namespace OpenSim.Services.Connectors } asset.Data = data; - string uri = MapServer(id) + "/assets/" + id; + string uri = Path.Combine(MapServer(id), Path.Combine("assets", id)); if (SynchronousRestObjectRequester. MakeRequest("POST", uri, asset)) @@ -471,7 +473,7 @@ namespace OpenSim.Services.Connectors public bool Delete(string id) { - string uri = MapServer(id) + "/assets/" + id; + string uri = Path.Combine(MapServer(id), Path.Combine("assets", id)); if (SynchronousRestObjectRequester. MakeRequest("DELETE", uri, 0)) -- cgit v1.1