Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion application/single_app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
EXECUTOR_TYPE = 'thread'
EXECUTOR_MAX_WORKERS = 30
SESSION_TYPE = 'filesystem'
VERSION = "0.237.010"
VERSION = "0.237.011"

SECRET_KEY = os.getenv('SECRET_KEY', 'dev-secret-key-change-in-production')

Expand Down
19 changes: 10 additions & 9 deletions application/single_app/route_frontend_chats.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ def upload_file():
file.seek(0)

filename = secure_filename(file.filename)
file_ext = os.path.splitext(filename)[1].lower()
file_ext = os.path.splitext(filename)[1].lower() # e.g., '.png'
file_ext_nodot = file_ext.lstrip('.') # e.g., 'png'

with tempfile.NamedTemporaryFile(delete=False) as tmp_file:
file.save(tmp_file.name)
Expand All @@ -131,9 +132,9 @@ def upload_file():

try:
# Check if this is an image file
is_image_file = file_ext in IMAGE_EXTENSIONS
is_image_file = file_ext_nodot in IMAGE_EXTENSIONS

if file_ext in ['.pdf', '.docx', '.pptx', '.ppt', '.html'] or is_image_file:
if file_ext_nodot in (DOCUMENT_EXTENSIONS | {'html'}) or is_image_file:
extracted_content_raw = extract_content_with_azure_di(temp_file_path)

# Convert pages_data list to string
Expand Down Expand Up @@ -191,25 +192,25 @@ def upload_file():
print(f"Warning: Vision analysis failed for chat upload: {vision_error}")
# Continue without vision analysis

elif file_ext in ['.doc', '.docm']:
elif file_ext_nodot in {'doc', 'docm'}:
# Use docx2txt for .doc and .docm files
try:
import docx2txt
extracted_content = docx2txt.process(temp_file_path)
except ImportError:
return jsonify({'error': 'docx2txt library required for .doc/.docm files'}), 500
elif file_ext == '.txt':
elif file_ext_nodot == 'txt':
extracted_content = extract_text_file(temp_file_path)
elif file_ext == '.md':
elif file_ext_nodot == 'md':
extracted_content = extract_markdown_file(temp_file_path)
elif file_ext == '.json':
elif file_ext_nodot == 'json':
with open(temp_file_path, 'r', encoding='utf-8') as f:
parsed_json = json.load(f)
extracted_content = json.dumps(parsed_json, indent=2)
elif file_ext in ['.xml', '.yaml', '.yml', '.log']:
elif file_ext_nodot in {'xml', 'yaml', 'yml', 'log'}:
# Handle XML, YAML, and LOG files as text for inline chat
extracted_content = extract_text_file(temp_file_path)
elif file_ext in TABULAR_EXTENSIONS:
elif file_ext_nodot in TABULAR_EXTENSIONS:
extracted_content = extract_table_file(temp_file_path, file_ext)
is_table = True
else:
Expand Down
8 changes: 7 additions & 1 deletion docs/explanation/release_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@

# Feature Release

### **(v0.237.010)**
### **(v0.237.011)**

#### Bug Fixes

* **Chat File Upload "Unsupported File Type" Fix**
* Fixed issue where uploading xlsx, png, jpg, csv, and other image/tabular files in the chat interface returned a 400 "Unsupported file type" error.
* **Root Cause**: `os.path.splitext()` returns extensions with a leading dot (e.g., `.png`), but the `IMAGE_EXTENSIONS` and `TABULAR_EXTENSIONS` sets in `config.py` store extensions without dots (e.g., `png`). The comparison `'.png' in {'png', ...}` was always `False`, causing all image and tabular uploads to fall through to the unsupported file type error.
* **Solution**: Added `file_ext_nodot = file_ext.lstrip('.')` and used the dot-stripped extension for set comparisons against `IMAGE_EXTENSIONS` and `TABULAR_EXTENSIONS`, matching the pattern already used in `functions_documents.py`.
* (Ref: `route_frontend_chats.py`, file extension comparison, `IMAGE_EXTENSIONS`, `TABULAR_EXTENSIONS`)

* **Manage Group Page Duplicate Code and Error Handling Fix**
* Fixed multiple code quality and user experience issues in the Manage Group page JavaScript.
* **Duplicate Event Handlers**: Removed duplicate event handler registrations (lines 96-127) for `.select-user-btn`, `.remove-member-btn`, `.change-role-btn`, `.approve-request-btn`, and `.reject-request-btn` that were causing multiple event firings.
Expand Down