Skip to content

Commit

Permalink
Merge pull request #3904 from nextcloud/backport/3870/stable26
Browse files Browse the repository at this point in the history
  • Loading branch information
juliusknorr authored Mar 6, 2023
2 parents 327869b + 092a05d commit 9ee25d0
Show file tree
Hide file tree
Showing 14 changed files with 40 additions and 21 deletions.
23 changes: 21 additions & 2 deletions cypress/e2e/nodes/Links.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ describe('test link marks', function() {
})

describe('autolink', function() {
it('with protocol', () => {
it('with protocol to files app and fileId', () => {
cy.getFile(fileName)
.then($el => {
const id = $el.data('id')

const link = `${Cypress.env('baseUrl')}/file-name?fileId=${id}`
const link = `${Cypress.env('baseUrl')}/apps/files/file-name?fileId=${id}`
cy.clearContent()
.type(`${link}{enter}`)

Expand All @@ -63,6 +63,25 @@ describe('test link marks', function() {
})
})

it('with protocol and fileId', () => {
cy.getFile(fileName)
.then($el => {
const id = $el.data('id')

const link = `${Cypress.env('baseUrl')}/file-name?fileId=${id}`
cy.clearContent()
.type(`${link}{enter}`)

cy.getContent()
.find(`a[href*="${Cypress.env('baseUrl')}"]`)
.click({ force: true })

cy.get('@winOpen')
.should('have.been.calledOnce')
.should('have.been.calledWithMatch', new RegExp(`${Cypress.env('baseUrl')}/file-name\\?fileId=${id}$`))
})
})

it('without protocol', () => {
cy.clearContent()
.type('google.com{enter}')
Expand Down
4 changes: 2 additions & 2 deletions js/editor.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/editor.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-editors.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-editors.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-files.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-files.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-public.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-public.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-text.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-text.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-viewer.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-viewer.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/helpers/links.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ const openLink = function(event, _attrs) {
OCA.Viewer.open({ path })
return
}
if (query?.fileId) {
if (htmlHref.match(/apps\/files\//) && query?.fileId) {
// open the direct file link
window.open(generateUrl(`/f/${query.fileId}`), '_self')
return
Expand Down

0 comments on commit 9ee25d0

Please sign in to comment.