mirror of
https://github.com/zulip/zulip.git
synced 2025-11-09 00:18:12 +00:00
Fix sending to a stream with a space in its name.
Previously if you tried to send to "a b", we actually ended up trying to send to "a%20b", since we were url-encoding the stream name and then not properly decoding it. (imported from commit 307d2999bd309e47fc654ae4422ab4372edde064)
This commit is contained in:
@@ -22,7 +22,7 @@ urlpatterns = patterns('',
|
||||
url(r'^json/subscriptions/list$', 'zephyr.views.json_list_subscriptions', name='json_list_subscriptions'),
|
||||
url(r'^json/subscriptions/remove$', 'zephyr.views.json_remove_subscription', name='json_remove_subscription'),
|
||||
url(r'^json/subscriptions/add$', 'zephyr.views.json_add_subscription', name='json_add_subscription'),
|
||||
url(r'^json/subscriptions/exists/(?P<stream>.*)$', 'zephyr.views.json_stream_exists', name='json_stream_exists'),
|
||||
url(r'^json/subscriptions/exists$', 'zephyr.views.json_stream_exists', name='json_stream_exists'),
|
||||
|
||||
# These are json format views used by the API. They require an API key.
|
||||
url(r'^api/v1/get_messages$', 'zephyr.views.api_get_messages', name='api_get_messages'),
|
||||
|
||||
@@ -102,7 +102,8 @@ function check_stream_for_send(stream_name) {
|
||||
var okay = true;
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/json/subscriptions/exists/" + stream_name,
|
||||
url: "/json/subscriptions/exists",
|
||||
data: {'stream': stream_name},
|
||||
async: false,
|
||||
success: function (data) {
|
||||
if (data.exists === "False") {
|
||||
|
||||
@@ -123,7 +123,7 @@ class PublicURLTest(TestCase):
|
||||
"/json/settings/change/",
|
||||
"/json/subscriptions/list",
|
||||
"/json/subscriptions/remove",
|
||||
"/json/subscriptions/exists/test",
|
||||
"/json/subscriptions/exists",
|
||||
"/json/subscriptions/add"],
|
||||
}
|
||||
for status_code, url_set in urls.iteritems():
|
||||
|
||||
@@ -591,7 +591,10 @@ def json_change_settings(request):
|
||||
return json_success(result)
|
||||
|
||||
@login_required_json_view
|
||||
def json_stream_exists(request, stream):
|
||||
def json_stream_exists(request):
|
||||
if "stream" not in request.POST:
|
||||
return json_error("Missing stream argument.")
|
||||
stream = request.POST.get("stream")
|
||||
if not valid_stream_name(stream):
|
||||
return json_error("Invalid characters in stream name")
|
||||
exists = bool(get_stream(stream, UserProfile.objects.get(user=request.user).realm))
|
||||
|
||||
Reference in New Issue
Block a user