Commit 94213034 authored by Your Name's avatar Your Name

Fix: Use user's home directory for temporary uploads instead of /tmp

The /tmp directory often doesn't allow web servers to create subdirectories. Now uses:
- Config admin: ~/.aisbf/temp_uploads/
- Database users: ~/.aisbf/user_auth_files/{user_id}/temp_uploads/

This ensures uploads work in all environments including restrictive web server configurations.
parent 99ed03ac
...@@ -5724,8 +5724,13 @@ async def dashboard_provider_upload_chunk( ...@@ -5724,8 +5724,13 @@ async def dashboard_provider_upload_chunk(
upload_id = hashlib.sha256(f"{current_user_id}:{provider_key}:{file_name}:{total_size}".encode()).hexdigest()[:16] upload_id = hashlib.sha256(f"{current_user_id}:{provider_key}:{file_name}:{total_size}".encode()).hexdigest()[:16]
file_ext = Path(file_name).suffix if file_name else '.bin' file_ext = Path(file_name).suffix if file_name else '.bin'
# Create temporary upload directory # Create temporary upload directory in user's home
temp_dir = Path('/tmp/aisbf_uploads') if is_config_admin:
# Config admin: use their home directory
temp_dir = Path.home() / '.aisbf' / 'temp_uploads'
else:
# Database user: use their auth files directory
temp_dir = get_user_auth_files_dir(current_user_id) / 'temp_uploads'
temp_dir.mkdir(parents=True, exist_ok=True) temp_dir.mkdir(parents=True, exist_ok=True)
# Save chunk # Save chunk
......
...@@ -136,8 +136,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. ...@@ -136,8 +136,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
let providersData = {{ providers_json | safe }}; let providersData = {{ providers_json | safe }};
let expandedProviders = new Set(); let expandedProviders = new Set();
// Chunk size: 1MB chunks for maximum compatibility with all proxies // Chunk size: 512KB chunks for maximum compatibility with restrictive proxies
const CHUNK_SIZE = 1 * 1024 * 1024; const CHUNK_SIZE = 512 * 1024;
// Generic chunked upload handler for all providers // Generic chunked upload handler for all providers
async function uploadFileChunked(providerKey, fileType, file, configObject) { async function uploadFileChunked(providerKey, fileType, file, configObject) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment