-
Notifications
You must be signed in to change notification settings - Fork 92
Logo bug fix #654
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
Logo bug fix #654
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| --- | ||
| applyTo: '**' | ||
| --- | ||
|
|
||
| # Release Notes Update Instructions | ||
|
|
||
| ## When to Update Release Notes | ||
|
|
||
| After completing a code change (bug fix, new feature, enhancement, or breaking change), always ask the user: | ||
|
|
||
| **"Would you like me to update the release notes in `docs/explanation/release_notes.md`?"** | ||
|
|
||
| ## If the User Confirms Yes | ||
|
|
||
| Update the release notes file following these guidelines: | ||
|
|
||
| ### 1. Location | ||
| Release notes are located at: `docs/explanation/release_notes.md` | ||
|
|
||
| ### 2. Version Placement | ||
| - Add new entries under the **current version** from `config.py` | ||
| - If the version has changed, create a new version section at the TOP of the file | ||
| - Format: `### **(vX.XXX.XXX)**` | ||
|
|
||
| ### 3. Entry Categories | ||
|
|
||
| Organize entries under the appropriate category: | ||
|
|
||
| #### New Features | ||
| ```markdown | ||
| #### New Features | ||
|
|
||
| * **Feature Name** | ||
| * Brief description of what the feature does and its benefits. | ||
| * Additional details about functionality or configuration. | ||
| * (Ref: relevant files, components, or concepts) | ||
| ``` | ||
|
|
||
| #### Bug Fixes | ||
| ```markdown | ||
| #### Bug Fixes | ||
|
|
||
| * **Fix Name** | ||
| * Description of what was broken and how it was fixed. | ||
| * Impact or affected areas. | ||
| * (Ref: relevant files, functions, or components) | ||
| ``` | ||
|
|
||
| #### User Interface Enhancements | ||
| ```markdown | ||
| #### User Interface Enhancements | ||
|
|
||
| * **Enhancement Name** | ||
| * Description of UI/UX improvements. | ||
| * (Ref: relevant templates, CSS, or JavaScript files) | ||
| ``` | ||
|
|
||
| #### Breaking Changes | ||
| ```markdown | ||
| #### Breaking Changes | ||
|
|
||
| * **Change Name** | ||
| * Description of what changed and why. | ||
| * **Migration**: Steps users need to take (if any). | ||
| ``` | ||
|
|
||
| ### 4. Entry Format Guidelines | ||
|
|
||
| - **Bold the title** of each entry | ||
| - Use bullet points for details | ||
| - Include a `(Ref: ...)` line with relevant file names, functions, or concepts | ||
| - Keep descriptions concise but informative | ||
| - Focus on user-facing impact, not implementation details | ||
|
|
||
| ### 5. Example Entry | ||
|
|
||
| ```markdown | ||
| * **Custom Logo Display Fix** | ||
| * Fixed issue where custom logos uploaded via Admin Settings would only display on the admin page but not on other pages (chat, sidebar, landing page). | ||
| * Root cause was overly aggressive sanitization removing logo URLs from public settings. | ||
| * (Ref: logo display, settings sanitization, template conditionals) | ||
| ``` | ||
|
|
||
| ### 6. Checklist Before Updating | ||
|
|
||
| - [ ] Confirm the current version in `config.py` | ||
| - [ ] Determine the correct category (New Feature, Bug Fix, Enhancement, Breaking Change) | ||
| - [ ] Write a clear, user-focused description | ||
| - [ ] Include relevant file/component references | ||
| - [ ] Place entry under the correct version section | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -88,7 +88,7 @@ | |
| EXECUTOR_TYPE = 'thread' | ||
| EXECUTOR_MAX_WORKERS = 30 | ||
| SESSION_TYPE = 'filesystem' | ||
| VERSION = "0.237.001" | ||
| VERSION = "0.237.003" | ||
|
||
|
|
||
|
|
||
| SECRET_KEY = os.getenv('SECRET_KEY', 'dev-secret-key-change-in-production') | ||
|
|
||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -319,8 +319,14 @@ <h5 class="mb-3"><i class="bi bi-hourglass-split me-2"></i>Retention Policy Sett | |
| <option value="default">Using organization default</option> | ||
| <option value="none">No automatic deletion</option> | ||
| <option value="1">1 day</option> | ||
| <option value="2">2 days</option> | ||
| <option value="3">3 days</option> | ||
| <option value="4">4 days</option> | ||
| <option value="5">5 days</option> | ||
| <option value="6">6 days</option> | ||
| <option value="7">7 days (1 week)</option> | ||
| <option value="10">10 days</option> | ||
| <option value="14">14 days (2 weeks)</option> | ||
|
Comment on lines
+322
to
+329
|
||
| <option value="21">21 days (3 weeks)</option> | ||
| <option value="30">30 days</option> | ||
| <option value="60">60 days</option> | ||
|
|
@@ -338,8 +344,14 @@ <h5 class="mb-3"><i class="bi bi-hourglass-split me-2"></i>Retention Policy Sett | |
| <option value="default">Using organization default</option> | ||
| <option value="none">No automatic deletion</option> | ||
| <option value="1">1 day</option> | ||
| <option value="2">2 days</option> | ||
| <option value="3">3 days</option> | ||
| <option value="4">4 days</option> | ||
| <option value="5">5 days</option> | ||
| <option value="6">6 days</option> | ||
| <option value="7">7 days (1 week)</option> | ||
| <option value="10">10 days</option> | ||
| <option value="14">14 days (2 weeks)</option> | ||
| <option value="21">21 days (3 weeks)</option> | ||
| <option value="30">30 days</option> | ||
| <option value="60">60 days</option> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| # Custom Logo Not Displaying Across App Fix | ||
|
|
||
| ## Issue Description | ||
| When an admin uploaded a custom logo via Admin Settings, the logo would display correctly on the admin settings page but **not appear elsewhere in the application** (e.g., chat page, sidebar navigation). | ||
|
|
||
| ### Symptoms | ||
| - Logo visible in Admin Settings preview | ||
| - Logo not appearing in sidebar navigation | ||
| - Logo not appearing on chat/chats pages | ||
| - Logo not appearing on index/landing page | ||
|
|
||
| ## Root Cause Analysis | ||
| The issue was in the `sanitize_settings_for_user()` function in [functions_settings.py](../../application/single_app/functions_settings.py). | ||
|
|
||
| This function is designed to strip sensitive data before sending settings to the frontend. It filters out any keys containing terms like: | ||
| - `key` | ||
| - `secret` | ||
| - `password` | ||
| - `connection` | ||
| - **`base64`** | ||
| - `storage_account_url` | ||
|
|
||
| The logo settings are stored with keys: | ||
| - `custom_logo_base64` | ||
| - `custom_logo_dark_base64` | ||
| - `custom_favicon_base64` | ||
|
|
||
| Because these keys contain `base64`, they were being **completely removed** from the sanitized settings. | ||
|
|
||
| ### Template Logic Impact | ||
| Templates check for custom logos using conditions like: | ||
| ```jinja2 | ||
| {% if app_settings.custom_logo_base64 %} | ||
| <img src="{{ url_for('static', filename='images/custom_logo.png') }}" /> | ||
| {% else %} | ||
| <img src="{{ url_for('static', filename='images/logo-lightmode.png') }}" /> | ||
| {% endif %} | ||
| ``` | ||
|
|
||
| When `custom_logo_base64` was stripped entirely, this condition always evaluated to `False`, causing the default logo to display instead of the custom uploaded logo. | ||
|
|
||
| ## Solution | ||
| Modified `sanitize_settings_for_user()` to add boolean flags for logo/favicon existence **after** the main sanitization loop. This allows templates to check if logos exist without exposing the actual base64 data. | ||
|
|
||
| ### Code Change | ||
| ```python | ||
| def sanitize_settings_for_user(full_settings: dict) -> dict: | ||
| # ... existing sanitization logic ... | ||
|
|
||
| # Add boolean flags for logo/favicon existence so templates can check without exposing base64 data | ||
| # These fields are stripped by the base64 filter above, but templates need to know if logos exist | ||
| if 'custom_logo_base64' in full_settings: | ||
| sanitized['custom_logo_base64'] = bool(full_settings.get('custom_logo_base64')) | ||
| if 'custom_logo_dark_base64' in full_settings: | ||
| sanitized['custom_logo_dark_base64'] = bool(full_settings.get('custom_logo_dark_base64')) | ||
| if 'custom_favicon_base64' in full_settings: | ||
| sanitized['custom_favicon_base64'] = bool(full_settings.get('custom_favicon_base64')) | ||
|
|
||
| return sanitized | ||
| ``` | ||
|
|
||
| ### How It Works | ||
| 1. The sensitive base64 data is still stripped during the main loop | ||
| 2. After sanitization, boolean flags are added: | ||
| - `True` if the logo exists (base64 string is non-empty) | ||
| - `False` if no logo is set (base64 string is empty) | ||
| 3. Templates can still use `{% if app_settings.custom_logo_base64 %}` and it will correctly evaluate to `True` or `False` | ||
| 4. The actual base64 data is never exposed to the frontend | ||
|
|
||
| ## Files Modified | ||
| - [functions_settings.py](../../application/single_app/functions_settings.py) - Modified `sanitize_settings_for_user()` function | ||
|
|
||
| ## Version | ||
| **Fixed in version:** 0.237.002 | ||
|
|
||
| ## Testing | ||
| A functional test was created: [test_custom_logo_sanitization_fix.py](../../functional_tests/test_custom_logo_sanitization_fix.py) | ||
|
|
||
| ### Test Cases | ||
| 1. **Logo flags preserved as True** - When logos exist, boolean flags are `True` | ||
| 2. **Logo flags preserved as False** - When logos are empty, boolean flags are `False` | ||
| 3. **No spurious flags added** - If logo keys don't exist in settings, they're not added | ||
| 4. **Template compatibility** - Boolean flags work correctly in Jinja2-style conditionals | ||
|
|
||
| ### Running the Test | ||
| ```bash | ||
| cd functional_tests | ||
| python test_custom_logo_sanitization_fix.py | ||
| ``` | ||
|
|
||
| ## Impact | ||
| This fix affects all pages that display the application logo: | ||
| - Landing/Index page | ||
| - Chat page | ||
| - Sidebar navigation (when left nav is enabled) | ||
| - Any other page using `base.html` that references logo settings | ||
|
|
||
| ## Security Considerations | ||
| - ✅ Actual base64 data is still never exposed to the frontend | ||
| - ✅ Only boolean True/False values are sent | ||
| - ✅ No sensitive data leakage | ||
| - ✅ Maintains the security intent of the original sanitization function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The addition of release notes update instructions is unrelated to the logo display bug fix. While this may be a useful guideline for the project, it should be in a separate PR or the PR description should be updated to mention this is also adding project documentation guidelines. Mixing infrastructure/process changes with bug fixes makes PR review and change tracking more difficult.