NimbusAPI / Nimbus

Nimbus is a .NET client library to provide an easy abstraction over common messaging frameworks.
http://nimbusapi.com/
MIT License
114 stars 84 forks source link

PathFactory can generate invalid Queue or Topic (%20 Edition) #161

Closed RyannosaurusRex closed 9 years ago

RyannosaurusRex commented 9 years ago

Related to #10, and essentially the same fix, except Sanitize needs a fix for spaces (in the form of %20) so that they get mapped to a period as well.

The remote server returned an error: (400) Bad Request. SubCode=40000. 'https://myappname.servicebus.windows.net/Q.UserQuery%20TestCommand/?api-version=2013-10' contains character(s) that is not allowed by Service Bus. Entity segments can contain only letters, numbers, periods (.), hyphens (-), and underscores (_)..TrackingId:60e8d3be-f322-4da9-adb3-ebc120d858b9_G8,TimeStamp:12/11/2013 12:44:48 AM
DamianMac commented 9 years ago

Good pickup! I'll patch that today

RyannosaurusRex commented 9 years ago

I'm using the latest Version 1.3.0.2 from NuGet.

Looking at Master, it seems like the whitelist approach should catch this, so it may already be fixed in source through 0315e044ff9592bccece099f12327661d8d0a3d6, though there's not a specific test yet for this scenario.

RyannosaurusRex commented 9 years ago

The space between "MYCOMPANY SOMETHING" is what ends up adding the %20 space in the path.

builder.Register(componentContext => new BusBuilder()
                                .Configure()
                                .WithNames("MYCOMPANY SOMETHING", Environment.MachineName)
                                .WithConnectionString(connectionString)
                                .WithDefaultHandlerFactory(messageHandlerFactory)
                                .WithTypesFrom(typeProvider)
                                .WithDefaultTimeout(TimeSpan.FromSeconds(10))
                                .WithAutofacDefaults(componentContext)
                                .Build())
                .As<IBus>()
                .AutoActivate()
                .OnActivated(c => c.Instance.Start())
                .SingleInstance();
ghost commented 9 years ago

@DamianMac did this get patched?

RyannosaurusRex commented 9 years ago

Following up. Any updates?

DamianMac commented 9 years ago

Hey there

Sorry, swamped... want to have a crack at it ?

RyannosaurusRex commented 9 years ago

No worries. I'll try and get a patch going this weekend or next if I get some time.

RyannosaurusRex commented 9 years ago

Went to check out what a fix would look like and pfft, it's already done. Added a test for spaces and did a PR, but this can be closed.