Closed Bug 1728972 Opened 4 years ago Closed 4 years ago

download-helper label hard coded instead of respecting XDG_DOWNLOAD_DIR

Categories

(Firefox :: Settings UI, defect)

Firefox 91
Desktop
Linux
defect

Tracking

()

RESOLVED DUPLICATE of bug 1707462

People

(Reporter: jontajonta, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0

Steps to reproduce:

  • ~/.config/user-dirs.dirs has the line XDG_DOWNLOAD_DIR="$HOME/downloads" (Note the lower-case "d")
  • New Firefox-profile
  • about:preferences
  • Files and applications
  • Downloads
  • Save files to

Actual results:

"Downloads"

Expected results:

"downloads"

(More important if one sets XDG_DOWNLOAD_DIR to something very different, of course)

This seems like the relevant code:

download-header = Downloads

in

https://searchfox.org/mozilla-central/source/browser/locales/en-US/browser/preferences/preferences.ftl

1st commit containing it:

https://searchfox.org/mozilla-central/rev/4a446201184f10a5e2ca4e0d65673f3c9e64413e/browser/locales/en-US/browser/preferences/preferences.ftl#213

(Woops. Forgot about Markdown. Parenthesis as heading is unintentional)

The Bugbug bot thinks this bug should belong to the 'Firefox::Preferences' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: Untriaged → Preferences

I was able to reproduce On My ubuntu 20 64bit the user-dirs.dirs has XDG_DOWNLOAD_DIR="$HOME/Downloads so i changed it with another folder name.

Then created new profiles for Firefox release 91.0.2, beta 92 and nightly 93.0a1 and firefox always showed me "Downloads" in about preferences

Severity: -- → S4
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Unspecified → Linux
Hardware: Unspecified → Desktop

(In reply to Jonathan from comment #0)

This seems like the relevant code:

download-header = Downloads
in
https://searchfox.org/mozilla-central/source/browser/locales/en-US/browser/preferences/preferences.ftl

This reference is just user-facing text and won't get used in determining any logic for the browser. I looked through our codebase and don't see any hardcoding of XDG_DOWNLOAD_DIR nor casing.

Martin, any idea what is happening here?

Flags: needinfo?(stransky)

Yes, we don't use XDG_DOWNLOAD_DIR env variable. It's just not implemented.

Flags: needinfo?(stransky)

nsXREDirProvider::GetFile() may be a correct place to add it.

We do honour this, I believe. Specifically, the unix implementation of DfltDwnld is at https://searchfox.org/mozilla-central/rev/eecd2dd4ba630bea4ce103623a4bfb398065b64b/xpcom/io/nsDirectoryService.cpp#449-452, which uses:

        GetSpecialSystemDirectory(Unix_XDG_Download, getter_AddRefs(localFile));

which in turn ends up at https://searchfox.org/mozilla-central/rev/eecd2dd4ba630bea4ce103623a4bfb398065b64b/xpcom/io/SpecialSystemDirectory.cpp#606

      return GetUnixXDGUserDirectory(aSystemSystemDirectory, aFile);

which uses the yucky-looking-but-probably-working code at https://searchfox.org/mozilla-central/rev/eecd2dd4ba630bea4ce103623a4bfb398065b64b/xpcom/io/SpecialSystemDirectory.cpp#348-370

static const char xdg_user_dirs[] =
    "DESKTOP\0"
    "DOCUMENTS\0"
    "DOWNLOAD\0"
    "MUSIC\0"
    "PICTURES\0"
    "PUBLICSHARE\0"
    "TEMPLATES\0"
    "VIDEOS";

static const uint8_t xdg_user_dir_offsets[] = {0, 8, 18, 27, 33, 42, 54, 64};

static nsresult GetUnixXDGUserDirectory(SystemDirectories aSystemDirectory,
                                        nsIFile** aFile) {
  char* dir = xdg_user_dir_lookup(
      xdg_user_dirs +
      xdg_user_dir_offsets[aSystemDirectory - Unix_XDG_Desktop]);

  nsresult rv;
  nsCOMPtr<nsIFile> file;
  if (dir) {
    rv = NS_NewNativeLocalFile(nsDependentCString(dir), true,
                               getter_AddRefs(file));

The summary of this bug is quite specific, and it is about the user-facing label in prefs being localized to "Downloads" because it's the OS-configured downloads folder, irrespective of the actual name of the folder or the path.

This is a duplicate.

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.