owncloud / calendar

Calendar app for ownCloud
GNU Affero General Public License v3.0
121 stars 43 forks source link

Problem with Firefox and PunyCode/IDN domain names (with, e.g., ä/ö/ü) #483

Open EriqJB opened 8 years ago

EriqJB commented 8 years ago

Steps to reproduce

  1. Install OwnCloud 9.0.1 under an URL with non-ASCII characters (e.g., an IDN domain with German umlauts such as ä,ö,ü)
  2. Use Mozilla Firefox 45.0.2
  3. Create a calendar or activate existing calendar in the browser frontend

    Expected behaviour

Calendar should be created when pressing "create" Existing calendar should be displayed (coloured dot left of the name should appear and events should be shown).

Actual behaviour

Calendar creation fails, clicking on the "create" button does not give a reaction Clicking on the name of an existing displays the spinner animated gif, but events do not appear Using Chrome as browser, everything works as expected

Server configuration

Operating system: Linux Web server: Apache Database: MySQL PHP version: 7 ownCloud version: (see ownCloud admin page) 9.0.1 Calendar version: (see ownCloud apps page) 1.1 Updated from an older ownCloud or fresh install: Fresh install

Reason

I've researched a bit and I think i can pin it down to js/vendor/davclient.js/lib/client.js: In line 364, a RegEx is used to match the URL. It is limited to ASCII characters. Obviously, the Chrome JavaScript engine replaces the URL with the PunyCode version, and Firefox does not. Thus, parsing the RegEx fails, the variable "parts" is null and the described behaviour occurs.

I am no JavaScript expert, but this may be a misbehaviour of Firefox JavaScript engine.

alpaclea commented 8 years ago

Hello, Very interesting diagnostic ! I have the same behavior (cf issue #477) and OC is indeed installed under a IDN domain. And if this issue is related to IDN, this explains why it hasn't been reported by more people. Well done.

georgehrke commented 8 years ago

@EriqJB Does the files app work just fine?

georgehrke commented 8 years ago

ping @EriqJB What's about the Files and the Contacts app? :)

georgehrke commented 8 years ago

also @alpaclea ^

alpaclea commented 8 years ago

Hello, The files app works ok. I don't use the contacts app. I can test though. Still, the bug with non-ascii characters is confirmed for me. and substituting [A-zÀ-ÿ] to [A-z] in the file /var/www/owncloud/apps/calendar/js/vendor/davclient.js/lib/client.js works for me . There must be better ways, sure ! var parts = url.match(/^(?:([A-zÀ-ÿ]+):)?(\/{0,3})([0-9.\-A-zÀ-ÿ]+)(?::(\d+))?(?:\/([^?#]*))?(?:\?([^#]*))?(?:#(.*))?$/);

Regards.

Caralluin commented 8 years ago

Hello, For anyone else suffering from this problem, there is another workaround beside using some other browser: setting the network.IDN_show_punycode configuration value under about:config to true apparently solves the issues. This comes at the cost of having the somewhat "ugly" punycode (domain names starting with xn--) shown in the address bar instead of the "nice" unicode domain name.

This workaround also solved a similar problem in Thunderbird for me.

Ascendor commented 8 years ago

I have the same issue with an IDN domain. Is there a ETA for a fix already?

georgehrke commented 8 years ago

@PVince81 Do you do smth special in the files app to prevent this?

PVince81 commented 8 years ago

@georgehrke there is no special logic for this in the files app

Ascendor commented 8 years ago

Any chance of this getting fixed?

Ascendor commented 7 years ago

How about using https://github.com/bestiejs/punycode.js to convert the url before processing?