mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	Fix upload auth redirect for user_activity.
Use rest_dispatch for upload auth redirect so it doesn't send the long URL to user_activity. (imported from commit ab327bbd529412e43eee6d109f8550180544dbbb)
This commit is contained in:
		@@ -1711,7 +1711,6 @@ def json_upload_file(request, user_profile, private=REQ(converter=json_to_bool,
 | 
			
		||||
    uri = upload_message_image_through_web_client(request, user_file, user_profile, private=private)
 | 
			
		||||
    return json_success({'uri': uri})
 | 
			
		||||
 | 
			
		||||
@authenticated_json_view
 | 
			
		||||
def get_uploaded_file(request, user_profile, realm_id, filename):
 | 
			
		||||
    # Internal users can access all uploads so we can receive attachments in cross-realm messages
 | 
			
		||||
    if user_profile.realm.id == int(realm_id) or user_profile.realm.domain == 'zulip.com':
 | 
			
		||||
 
 | 
			
		||||
@@ -41,8 +41,6 @@ urlpatterns = patterns('',
 | 
			
		||||
 | 
			
		||||
    url(r'^activity$', 'zerver.views.get_activity'),
 | 
			
		||||
 | 
			
		||||
    url(r'^user_uploads/(?P<realm_id>\d*)/(?P<filename>.*)', 'zerver.views.get_uploaded_file'),
 | 
			
		||||
 | 
			
		||||
    # Registration views, require a confirmation ID.
 | 
			
		||||
    url(r'^accounts/home/', 'zerver.views.accounts_home'),
 | 
			
		||||
    url(r'^accounts/send_confirm/(?P<email>[\S]+)?',
 | 
			
		||||
@@ -151,6 +149,9 @@ urlpatterns += patterns('zerver.views',
 | 
			
		||||
    url(r'^api/v1/external/newrelic$',      'webhooks.api_newrelic_webhook'),
 | 
			
		||||
    url(r'^api/v1/external/bitbucket$',     'webhooks.api_bitbucket_webhook'),
 | 
			
		||||
    url(r'^api/v1/external/desk$',          'webhooks.api_deskdotcom_webhook'),
 | 
			
		||||
 | 
			
		||||
    url(r'^user_uploads/(?P<realm_id>\d*)/(?P<filename>.*)', 'rest_dispatch',
 | 
			
		||||
        {'GET': 'get_uploaded_file'}),
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
v1_api_and_json_patterns = patterns('zerver.views',
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user