atlas-engineer / nyxt

Nyxt - the hacker's browser.
https://nyxt-browser.com/
9.88k stars 413 forks source link

download-url does nothing or the download fails #3274

Closed freddyholms closed 11 hours ago

freddyholms commented 11 months ago

Describe the bug When I call download-url on any buffer, nothing happens. Checking the downloads list all I see is that the download failed.

Precise recipe to reproduce the issue This is the Dockerfile I used to build nyxt

FROM docker.io/archlinux/archlinux:latest

RUN pacman -Sy --noconfirm git \
           sbcl \
       webkit2gtk \
       gobject-introspection \
       glib-networking \
       gsettings-desktop-schemas \
       enchant \
       libfixposix \
       gcc \
       pkg-config \
       gst-libav \
       gst-plugins-base \
       gst-plugins-good \
       gst-plugins-bad \
       gst-plugins-ugly \
       jack2 \
       wl-clipboard \
       ttf-dejavu \
       make && \
    mkdir -p /root/common-lisp && \
    git clone --recurse-submodules https://github.com/atlas-engineer/nyxt /root/common-lisp/nyxt

WORKDIR /root/common-lisp/nyxt

RUN make all

EXPOSE 4006

CMD /root/common-lisp/nyxt/nyxt

I run the container with

podman run -it -d -v $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY:/tmp/$WAYLAND_DISPLAY:ro \
-e MOZ_ENABLE_WAYLAND=1 \
-e XDG_SESSION_TYPE=wayland \
-e GDK_BACKEND=wayland \
-e QT_QPA_PLATFORM=wayland \
-e XDG_RUNTIME_DIR=/run/user/1000 \
-e WAYLAND_DISPLAY=$WAYLAND_DISPLAY \
-e PULSE_SERVER=/run/user/1000/pulse/native \
-v /run/user/1000:/run/user/1000 \
-v /home/<USER>/share-podman:/home \
-v /mnt:/mnt \
--name nyxt -p 4005:4006 --device /dev/dri -v /dev:/dev nyxt

Information

ASDF version: 3.3.1 ASDF registries: (NYXT-SOURCE-REGISTRY ENVIRONMENT-SOURCE-REGISTRY) Critical dependencies: (/root/common-lisp/nyxt/_build/cl-cffi-gtk/gtk/cl-cffi-gtk.asd /root/common-lisp/nyxt/_build/cl-gobject-introspection/cl-gobject-introspection.asd /root/common-lisp/nyxt/_build/cl-webkit/webkit2/cl-webkit2.asd)


There is no output from the shell, and no error in the minibuffer. I just get no feedback unless I check the download list and see that the download failed. 
aadcg commented 11 months ago

I can't reproduce it on a non-containerized environment.

I'd suggest evaluating nyxt --eval "(xdg-download-dir)" --quit in the containerized environment to check whether that folder is being exposed.

KonstantinDjairo commented 11 months ago

also happened to me, it does nothing when i try to download something

aadcg commented 11 months ago

@KonstantinDjairo can you provide a concrete recipe? What URL was downloaded? How did you install Nyxt?

zcal commented 5 months ago

I've been experiencing this issue, although calling download-url or following a download link would open the list-downloads buffer and where it would be reported to have failed. I'm not running Nyxt in a container, just installed on my Arch Linux system via the official repositories.

I discovered that that there were two factors causing this issue for me.

First, even though I had defined XDG_DOWNLOAD_DIR="$HOME/download" in my $HOME/.config/user-dirs.dirs, Nyxt did not appear to respect that and would fail the downloads due to the expected directory being missing. Creating $HOME/Downloads, the XDG default, fixed the problem.

Second, to get Nyxt to respect my $HOME/.config/user-dirs.dirs, I had to install the xdg-user-dirs package. Doing so sent the downloads to $HOME/download as desired.

aadcg commented 4 months ago

@zcal your issue seems to be different from the one reported in the top post.

The logic behind resolving the download folder is as below. Are you suggesting any changes to it?

(defun xdg-download-dir ()
  "Get the directory for user downloads.
Tries hard to find the XDG directory or at least ~/Downloads one."
  (let ((dir (ignore-errors (uiop:run-program '("xdg-user-dir" "DOWNLOAD")
                                              :output '(:string :stripped t)))))
    (when (or (null dir) (uiop:pathname-equal dir (user-homedir-pathname)))
      (setf dir (uiop:getenv "XDG_DOWNLOAD_DIR")))
    (unless dir
      (setf dir (uiop:merge-pathnames* #p"Downloads/" (user-homedir-pathname))))
    (uiop:ensure-pathname dir :ensure-directory t)))