aegis-framework 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/aegis/core/window.py +23 -5
- package/package.json +1 -1
package/aegis/core/window.py
CHANGED
|
@@ -686,9 +686,23 @@ class AegisWindow(Gtk.Window):
|
|
|
686
686
|
# Ensure destination directory exists
|
|
687
687
|
os.makedirs(os.path.dirname(dest) or '.', exist_ok=True)
|
|
688
688
|
|
|
689
|
-
# Check if aria2c is available
|
|
690
|
-
|
|
691
|
-
|
|
689
|
+
# Check if aria2c is available
|
|
690
|
+
aria2c_path = shutil.which('aria2c')
|
|
691
|
+
|
|
692
|
+
if aria2c_path:
|
|
693
|
+
# Check if aria2c is from snap (has sandbox restrictions on hidden dirs)
|
|
694
|
+
is_snap = '/snap/' in aria2c_path
|
|
695
|
+
|
|
696
|
+
# Check if destination is in a hidden directory
|
|
697
|
+
dest_has_hidden = any(part.startswith('.') for part in dest.split('/') if part)
|
|
698
|
+
|
|
699
|
+
# Use aria2c only if: not snap, OR dest is not hidden
|
|
700
|
+
if not is_snap or not dest_has_hidden:
|
|
701
|
+
self._download_with_aria2(url, dest, connections, callback_id)
|
|
702
|
+
else:
|
|
703
|
+
# Snap aria2c can't access hidden dirs - use urllib
|
|
704
|
+
print(f"[Aegis] Snap aria2c can't access hidden dirs, using urllib")
|
|
705
|
+
self._download_with_urllib(url, dest, callback_id)
|
|
692
706
|
else:
|
|
693
707
|
self._download_with_urllib(url, dest, callback_id)
|
|
694
708
|
|
|
@@ -767,10 +781,14 @@ class AegisWindow(Gtk.Window):
|
|
|
767
781
|
}
|
|
768
782
|
GLib.idle_add(self._send_response, callback_id, result)
|
|
769
783
|
else:
|
|
770
|
-
|
|
784
|
+
# aria2c failed (e.g., snap sandbox restrictions) - fallback to urllib
|
|
785
|
+
print(f"[Aegis] aria2c failed (code {process.returncode}), falling back to urllib")
|
|
786
|
+
self._download_with_urllib(url, dest, callback_id)
|
|
771
787
|
|
|
772
788
|
except Exception as e:
|
|
773
|
-
|
|
789
|
+
# On any error, fallback to urllib
|
|
790
|
+
print(f"[Aegis] aria2c error: {e}, falling back to urllib")
|
|
791
|
+
self._download_with_urllib(url, dest, callback_id)
|
|
774
792
|
|
|
775
793
|
def _download_with_urllib(self, url, dest, callback_id):
|
|
776
794
|
"""Fallback download using urllib (single connection)"""
|
package/package.json
CHANGED