mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	Fix: include subpath in logo url (#8374)
This commit is contained in:
		| @@ -14,7 +14,7 @@ def settings(request): | ||||
|     app_logo = ( | ||||
|         django_settings.APP_LOGO | ||||
|         if general_config.app_logo is None or len(general_config.app_logo) == 0 | ||||
|         else general_config.app_logo | ||||
|         else django_settings.BASE_URL + general_config.app_logo.lstrip("/") | ||||
|     ) | ||||
|  | ||||
|     return { | ||||
|   | ||||
| @@ -6,12 +6,14 @@ from django.conf import settings | ||||
| from django.contrib.auth.models import Permission | ||||
| from django.contrib.auth.models import User | ||||
| from django.test import TestCase | ||||
| from django.test import override_settings | ||||
| from django.utils import timezone | ||||
| from rest_framework import status | ||||
|  | ||||
| from documents.models import Document | ||||
| from documents.models import ShareLink | ||||
| from documents.tests.utils import DirectoriesMixin | ||||
| from paperless.models import ApplicationConfiguration | ||||
|  | ||||
|  | ||||
| class TestViews(DirectoriesMixin, TestCase): | ||||
| @@ -67,6 +69,26 @@ class TestViews(DirectoriesMixin, TestCase): | ||||
|                 f"frontend/{language_actual}/main.js", | ||||
|             ) | ||||
|  | ||||
|     @override_settings(BASE_URL="/paperless/") | ||||
|     def test_index_app_logo_with_base_url(self): | ||||
|         """ | ||||
|         GIVEN: | ||||
|             - Existing config with app_logo specified | ||||
|         WHEN: | ||||
|             - Index page is loaded | ||||
|         THEN: | ||||
|             - app_logo is prefixed with BASE_URL | ||||
|         """ | ||||
|         config = ApplicationConfiguration.objects.first() | ||||
|         config.app_logo = "/logo/example.jpg" | ||||
|         config.save() | ||||
|         self.client.force_login(self.user) | ||||
|         response = self.client.get("/") | ||||
|         self.assertEqual( | ||||
|             response.context["APP_LOGO"], | ||||
|             f"/paperless{config.app_logo}", | ||||
|         ) | ||||
|  | ||||
|     def test_share_link_views(self): | ||||
|         """ | ||||
|         GIVEN: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 shamoon
					shamoon