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

Direct editing breaks with internal links #1169

Closed
juliushaertl opened this issue Nov 12, 2020 · 4 comments · Fixed by #3442
Closed

Direct editing breaks with internal links #1169

juliushaertl opened this issue Nov 12, 2020 · 4 comments · Fixed by #3442
Assignees
Labels
bug Something isn't working

Comments

@juliushaertl
Copy link
Member

image

@juliushaertl juliushaertl added the bug Something isn't working label Nov 12, 2020
@juliushaertl
Copy link
Member Author

Found when looking into nextcloud/android#7192

@paulRbr
Copy link

paulRbr commented Dec 3, 2020

Hi there, this bug is easy to reproduce:

  • create a new markdown file
  • Type some text then use the nextcloud text editor to add an internal link by selecting the text and hitting the button « link to a file » and choose a NC file to link
  • Share the markdown file with a public link
  • Open the public link and the file preview will not render and the following error will be present in the JS console:
Failed to update steps in collaboration plugin TypeError: OCA.Viewer is undefined

(I commented here to add the text of the error in case some people search for it through a search engine)

@matthijskooijman
Copy link

matthijskooijman commented Jan 13, 2021

I also ran into this issue. Unlike what the title suggests, for me it also breaks when viewing a markdown file through a read-only share link.

Looking at the generated HTML, it seems that the javascript file for the viewer app is not included in the page, which explains why OCA.Viewer is not available. Maybe there is a missing dependency in this app somewhere (not sure how this stuff works, though). It seems that when editing the markdown file through the regular edit interface (i.e. when logged in), the viewer app js is included in the <head> (maybe because some other app that is also used in this view does declare the dependency correctly or so?):

<script nonce="" defer="" src="/apps/viewer/js/viewer-main.js?v=855d4adb-3"></script>

@Raudius
Copy link
Contributor

Raudius commented Nov 16, 2022

When opening the file in the direct edit/public view we dont have access to the files app and the user might not even be logged in.

Steps to fix

  • Dont assume OCA.Viewer is available in src/helpers/links.js#domHref
  • Forward opening of URL in window, will redirect the user to /login if not logged in

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants