Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QDesktopServices::openUrl() fails in Qt 6.8 on macOS for file paths with special characters ([, ])
Forum Updated to NodeBB v4.3 + New Features

QDesktopServices::openUrl() fails in Qt 6.8 on macOS for file paths with special characters ([, ])

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 104 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    PuskasAlex
    wrote on last edited by
    #1

    I’ve encountered a regression in behavior when upgrading from Qt 5.15 to Qt 6.8 on macOS related to QDesktopServices::openUrl().

    Working code in Qt 5.15:

    QString x = "/Volumes/Untitled 99/testfolder1/test copy'[.txt";
    
    QFileInfo fi(x);
    qDebug() << "Exists:" << fi.exists() << ", isFile:" << fi.isFile();
    
    QUrl url = QUrl::fromLocalFile(x);
    
    bool ret = QDesktopServices::openUrl(url);
    qDebug() << "RET:" << ret;
    
    

    Output on Qt 5.15 (macOS):

    Exists: true , isFile: true
    RET: true

    Same code fails in Qt 6.8:

    • list itemQFileInfo confirms the file exists
    • QUrl::fromLocalFile() generates a valid URL
    • But QDesktopServices::openUrl() returns false (Character [ appear to break the behavior)

    There is any workaround?

    Christian EhrlicherC 1 Reply Last reply
    0
    • P PuskasAlex

      I’ve encountered a regression in behavior when upgrading from Qt 5.15 to Qt 6.8 on macOS related to QDesktopServices::openUrl().

      Working code in Qt 5.15:

      QString x = "/Volumes/Untitled 99/testfolder1/test copy'[.txt";
      
      QFileInfo fi(x);
      qDebug() << "Exists:" << fi.exists() << ", isFile:" << fi.isFile();
      
      QUrl url = QUrl::fromLocalFile(x);
      
      bool ret = QDesktopServices::openUrl(url);
      qDebug() << "RET:" << ret;
      
      

      Output on Qt 5.15 (macOS):

      Exists: true , isFile: true
      RET: true

      Same code fails in Qt 6.8:

      • list itemQFileInfo confirms the file exists
      • QUrl::fromLocalFile() generates a valid URL
      • But QDesktopServices::openUrl() returns false (Character [ appear to break the behavior)

      There is any workaround?

      Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @PuskasAlex said in QDesktopServices::openUrl() fails in Qt 6.8 on macOS for file paths with special characters ([, ]):

      There is any workaround?

      Except creating a bug report (search before if there is already one) - compare the code between Qt5 and Qt6 - maybe you can spot the problem.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved