Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Certain file types (.pdf and .docx) files will not open in the IDE on macOS Big Sur. #8506

Closed
3 of 4 tasks
R-Hannibal opened this issue Dec 2, 2020 · 10 comments · Fixed by #8525
Closed
3 of 4 tasks
Assignees
Milestone

Comments

@R-Hannibal
Copy link

@R-Hannibal R-Hannibal commented Dec 2, 2020

System details

RStudio Edition : Desktop
RStudio Version : 1.3.1093 / 1.4.1072
OS Version      : macOS Big Sur Version 11.1 Beta
R Version       : 4.0.3

Steps to reproduce the problem

  1. Open the IDE > Navigate in the files pane to either a .docx or .pdf file and select it.

Describe the problem in detail

These 2 doc types (.docx + .pdf) appear inert in the IDE as selecting them from the files pane has no effect.

Describe the behavior you expected

Selecting either a .docx or .pdf file in the files pane opens it outside of the IDE.

Notes

  • I have read the guide for submitting good bug reports.
  • I have installed the latest version of RStudio, and confirmed that the issue still persists.
  • If I am reporting a RStudio crash, I have included a diagnostics report.
  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
@rressler
Copy link

@rressler rressler commented Dec 2, 2020

I have the same issue (Mac os 11.0.1). It also affects html files. They will open in the editor but not in the browser.

@shirispitzsiddiqi
Copy link

@shirispitzsiddiqi shirispitzsiddiqi commented Dec 2, 2020

Same issue for me! I have no info to add, just want to make it known and receive notifications about this...

@R-Hannibal
Copy link
Author

@R-Hannibal R-Hannibal commented Dec 2, 2020

Moving this issue into 1.4, seems like this is effecting lots of users.

Also, comment from @jjallaire - If this also prevents PDF preview for R Markdown / Sweave from working then it definitely meets the bar (for 1.4).

@ronblum
Copy link
Contributor

@ronblum ronblum commented Dec 2, 2020

The problem is limited to files with spaces in the name.

@ronblum
Copy link
Contributor

@ronblum ronblum commented Dec 2, 2020

Note: This also includes .html, .xls, and .xlsx files with spaces in the name. So, probably anything that involves opening an external application, if there are spaces in the name. (Checked on MacOS Big Sur 11.1 Beta 20C5048k.)

@rressler
Copy link

@rressler rressler commented Dec 2, 2020

@kevinushey
Copy link
Contributor

@kevinushey kevinushey commented Dec 2, 2020

@rressler: what is the full path to the file? Does that path contain any spaces (e.g. in your user name, project name, or elsewhere)?

@rressler
Copy link

@rressler rressler commented Dec 3, 2020

@gtritchie
Copy link
Member

@gtritchie gtritchie commented Dec 3, 2020

Investigation in progress, some notes:

  • this is Big Sur-specific (doesn't happen on Catalina)
  • if you run RStudio from terminal, and try to open a pdf, word-doc, etc. with spaces in the path you see something like this:
The file /Applications/RStudio.app/Contents/MacOS/file:/Users/gary/Desktop/word the doc.docx does not exist.

In this case that actual file is /Users/gary/Desktop/word the doc.docx not sure why the Application path is being prepended to the error displayed by the open command.

The code that loads files in this situation is here:

if (qurl.scheme() == QString::fromUtf8("file"))
{
QProcess open;
QStringList args;
// force use of Preview for PDFs (Adobe Reader 10.01 crashes)
if (url.toLower().endsWith(QString::fromUtf8(".pdf")))
{
args.append(QString::fromUtf8("-a"));
args.append(QString::fromUtf8("Preview"));
args.append(url);
}
else
{
args.append(url);
}
open.start(QString::fromUtf8("open"), args);
open.waitForFinished(5000);
if (open.exitCode() != 0)
{
// Probably means that the file doesn't have a registered
// application or something.
QProcess reveal;
reveal.startDetached(QString::fromUtf8("open"), QStringList() << QString::fromUtf8("-R") << url);
}
return;
}

I tried a few obvious escaping strategies with no success (surround the path with quotes, put backslash in front of spaces).

gtritchie added a commit that referenced this issue Dec 3, 2020
- Fixes #8506
- For reasons I couldn't quite figure out, the Mac-specific logic for opening external files (e.g. Word docs, PDFs) was failing when those paths contained spaces and no amount of escaping or otherwise helped.
- The fix was to have Mac use the same code as other platforms for opening files; namely, QDesktopServices::openUrl()
- This changes how PDFs are opening; instead of forcing them to always use Preview, they will now use whatever is registered in the system (e.g. Acrobat); there was a comment about problems with Acrobat 10, but Acrobat 10 is from 2010 and current version of Acrobat works fine
@ronblum
Copy link
Contributor

@ronblum ronblum commented Dec 17, 2020

Confirmed in RStudio Desktop 1.4.1093 by open a file with .html, .docx, .xlsx, and .pdf files with spaces in the name, and .xlsx with a space in the parent directory's name. In addition, for .xlsx, also confirmed that Import Dataset is successful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants