You are not logged in.

#1 2015-09-02 15:07:41

mpir
Member
Registered: 2013-09-20
Posts: 15

[Solved]Google Chrome: Problem with whitespace when opening files

Hello there,

after upgrading google chrome to 45.0.2454.85-1 (available on AUR) I have the following problem:

when opening files that contain whitespace in the filename (eg. '~/Documents/An archived page.html'), instead of opening the file Chrome will open 3 tabs like so:

file:://~/Documents/An
http://archived/
http://page.html/

ie. instead of replacing spaces with %20,  it spawns a new tab for each space. Before the update it was fully functional.

Any help will be appreciated!

Last edited by mpir (2015-09-04 09:59:11)

Offline

#2 2015-09-02 15:33:26

Awebb
Member
Registered: 2010-05-06
Posts: 6,282

Re: [Solved]Google Chrome: Problem with whitespace when opening files

Describe this "opening files" a bit closer. What do you do and where?

Offline

#3 2015-09-02 16:18:34

mpir
Member
Registered: 2013-09-20
Posts: 15

Re: [Solved]Google Chrome: Problem with whitespace when opening files

The problem appears when opening with Thunar, and also with

xdg-open /path/to/file\ with\ whitespace.pdf
google-chrome-stable /path/to/file\ with\ whitspace.pdf

The problem does NOT appear when opening inside Chrome, ie. from Downloads.

Offline

#4 2015-09-02 16:18:36

Ropid
Member
Registered: 2015-03-09
Posts: 1,069

Re: [Solved]Google Chrome: Problem with whitespace when opening files

I just tried it over here and I see the same issue as you do. These examples should work, but don't:

$ google-chrome-stable a\ test\ folder/
$ google-chrome-stable "a test folder"

Just like you explain, it opens three tabs and behaves as if it had been started like this:

$ google-chrome-stable "a" "test" "folder"

It works when started like this:

$ google-chrome-stable a%20test%20folder

Offline

#5 2015-09-02 16:42:24

ugjka
Member
From: Latvia
Registered: 2014-04-01
Posts: 1,806
Website

Re: [Solved]Google Chrome: Problem with whitespace when opening files


https://ugjka.net
paru > yay | webcord > discord
pacman -S spotify-launcher
mount /dev/disk/by-...

Offline

#6 2015-09-02 16:52:54

mpir
Member
Registered: 2013-09-20
Posts: 15

Re: [Solved]Google Chrome: Problem with whitespace when opening files

Which version do you have, Ropid?
I am not sure how these two commands should behave, but I am sure I used to open files with a click from thunar.

After updating google-chrome today from 43 to 45, the affirmed thunar functionality is lost.  I also updated other packages, so I am not 100% sure that Chrome itself caused the break. I did not upgrade thunar or xdg-open.

Offline

#7 2015-09-03 18:17:37

mpir
Member
Registered: 2013-09-20
Posts: 15

Re: [Solved]Google Chrome: Problem with whitespace when opening files

I've found the source of the problem.

%> readlink -f /usr/bin/google-chrome-stable
/usr/bin/google-chrome-stable

whilst it should return

/opt/google/chrome/google-chrome

The command

/opt/google/chrome/google-chrome /path/to/file\ with\ spaces.html

opens the file as it should

It seems that the symbolic link is broken, as it is confirmed by the fellow user above.

My fix:

sudo mv /usr/bin/google-chrome-stable /usr/bin/google-chrome-stable.bak
sudo ln -s /opt/google/chrome/google-chrome /usr/bin/google-chrome-stable

Is it OK to do this?

Offline

#8 2015-09-03 19:28:49

Ropid
Member
Registered: 2015-03-09
Posts: 1,069

Re: [Solved]Google Chrome: Problem with whitespace when opening files

I think it's okay to replace it like you did. Pacman will tell you something the next time you update if it can't replace it by itself and needs help.

I looked inside that /usr/bin/google-chrome-stable file, and it is a shell script. It seems it has a bug. Its contents are the following over here for me:

#!/bin/bash

# Allow users to override command-line options
if [[ -f ~/.config/chrome-flags.conf ]]; then
   CHROME_USER_FLAGS="$(cat ~/.config/chrome-flags.conf)"
fi

# Launch
exec /opt/google/chrome/google-chrome $CHROME_USER_FLAGS $@

The bug is at the very end, at the $@. The script works correctly to open links with spaces if you change the $@ to "$@" (meaning add quotation marks).

Last edited by Ropid (2015-09-03 19:29:44)

Offline

#9 2015-09-04 10:04:41

mpir
Member
Registered: 2013-09-20
Posts: 15

Re: [Solved]Google Chrome: Problem with whitespace when opening files

Same issue here, your solution seems right.  Thanks for the help! Issue Solved.

Offline

#10 2015-09-04 18:36:02

ninian
Member
From: United Kingdom
Registered: 2008-02-24
Posts: 726
Website

Re: [Solved]Google Chrome: Problem with whitespace when opening files

I raised the same solution in the AUR comments for google-chrome, but the maintainer's response is:

No.

Offline

#11 2015-09-04 18:51:33

ugjka
Member
From: Latvia
Registered: 2014-04-01
Posts: 1,806
Website

Re: [Solved]Google Chrome: Problem with whitespace when opening files

ninian wrote:

I raised the same solution in the AUR comments for google-chrome, but the maintainer's response is:

No.

You didn't mention what the problem is. Dropping "methinks, you need to do X" isn't very explanatory...


https://ugjka.net
paru > yay | webcord > discord
pacman -S spotify-launcher
mount /dev/disk/by-...

Offline

#12 2015-09-04 19:03:58

det
Wiki Maintainer
Registered: 2009-07-11
Posts: 39

Re: [Solved]Google Chrome: Problem with whitespace when opening files

Also, marking this as "solved" is not the right approach. Updating the package would have just overwritten it.

Offline

#13 2015-09-04 19:04:22

ninian
Member
From: United Kingdom
Registered: 2008-02-24
Posts: 726
Website

Re: [Solved]Google Chrome: Problem with whitespace when opening files

ugjka wrote:

You didn't mention what the problem is. Dropping "methinks, you need to do X" isn't very explanatory...

Yup, cryptic we are.

Offline

#14 2015-09-04 19:12:25

ugjka
Member
From: Latvia
Registered: 2014-04-01
Posts: 1,806
Website

Re: [Solved]Google Chrome: Problem with whitespace when opening files

Fixed...

Det wrote:

Didn't bump the pkgrel. It's quicker to add the quotes yourself.


https://ugjka.net
paru > yay | webcord > discord
pacman -S spotify-launcher
mount /dev/disk/by-...

Offline

Board footer

Powered by FluxBB