Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception thrown in api.ListDirectory() when listing a path name containing one or more '\' characters #8

Open
GoogleCodeExporter opened this issue Jul 20, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Calling api.ListDirectory() function with an ObjectPath that has a pathname 
value that contains a '\' character causes it throw an exception.

e.g. /apache/S1Service/.mauiws/Test\ATMOS/

What is the expected output? What do you see instead?
The function should complete successfully without throwing an exception.

What version of the product are you using? On what operating system?
2.1.4.31

Please provide any additional information below.

I have narrowed down to where the issue seems to be occurring which is at line 
3718 in EsuRestApi.cs. 

protected virtual Uri buildUrl( string resource ) 
{
  return new Uri( protocol + "://" + host + ":" + port + resource );
}

The Uri constructor seems to be changing the '\' character to '/'.

The following error thrown is:

Error ecountered. Error Details:
-----------------------------------

Exception:      EsuApiLib.EsuException
Message:        There was a mismatch between the signature in the request and 
the signature computed by the server.
Source:         EsuApiLib
TargetSite:     Void handleError(System.Net.HttpWebResponse)

StackTrace
--------------

   at EsuApiLib.Rest.EsuRestApi.handleError(HttpWebResponse resp) in d:\Projects\Test\EsuDotNet_2.1.4.31\EsuApiLib\Rest\EsuRestApi.cs:line 392
3
   at EsuApiLib.Rest.EsuRestApi.ListDirectory(ObjectPath path, ListOptions options) in d:\Projects\Test\EsuDotNet_2.1.4.31\EsuApiLib\Rest\EsuR
estApi.cs:line 2952
   at EsuApiLib.Rest.EsuRestApi.ListDirectory(ObjectPath path) in d:\Projects\Test\EsuDotNet_2.1.4.31\EsuApiLib\Rest\EsuRestApi.cs:line 2847
   at Test.GetObjectMetaData.GetDir(EsuRestApi& api, DirectoryEntry DirEntry) in D:\Projects\Test\Test\GetObjectMetaData.cs:line 76
   at Test.GetObjectMetaData.GetDir(EsuRestApi& api, DirectoryEntry DirEntry) in D:\Projects\Test\Test\GetObjectMetaData.cs:line 80
   at Test.GetObjectMetaData.GetDir(EsuRestApi& api, DirectoryEntry DirEntry) in D:\Projects\Test\Test\GetObjectMetaData.cs:line 80
   at Test.GetObjectMetaData.GetDir(EsuRestApi& api, DirectoryEntry DirEntry) in D:\Projects\Test\Test\GetObjectMetaData.cs:line 80
   at Test.GetObjectMetaData.GetObjectMetadata(EsuRestApi& api, ObjectId& oid) in D:\Projects\Test\Test\GetObjectMetaData.cs:line 52
   at Test.Options.ExecOptions(EsuRestApi& api) in D:\Projects\Test\Test\Options.cs:line 70
   at Test.Program.Main(String[] args) in D:\Projects\Test\Test\Program.cs:line 49

Original issue reported on code.google.com by [email protected] on 24 Apr 2014 at 8:11

@GoogleCodeExporter
Copy link
Author

Also see:
https://connect.microsoft.com/VisualStudio/feedback/details/472836/uri-incorrect
ly-unescapes-5c-character

Per the article Microsoft's .Net dev team would decide on fixing it in the 
final release of the .Net 4.0 framework. I am compiling using .Net 4.0 and it 
does not appear to have been fixed.

BTW directory listing for directories with '\' character is working fine with 
ATMOS browser.

I have tried using the Uri.EscapeUriString function to escape the '\' character 
but it is not working.

In addition the URI constructor public Uri(string uriString, bool dontEscape) 
which would have allowed using characters such as '\' has been deprecated and 
does not work with .Net 4.0.

Is there a work around.

Original comment by [email protected] on 24 Apr 2014 at 10:16

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant