files-xml-regression.cy.ts 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /**
  2. * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
  3. * SPDX-License-Identifier: AGPL-3.0-or-later
  4. */
  5. import { getRowForFile, triggerActionForFile } from './FilesUtils.ts'
  6. /**
  7. * This is a regression test for https://github.com/nextcloud/server/issues/43331
  8. * Where files with XML entities in their names were wrongly displayed and could no longer be renamed / deleted etc.
  9. */
  10. describe('Files: Can handle XML entities in file names', { testIsolation: false }, () => {
  11. before(() => {
  12. cy.createRandomUser().then((user) => {
  13. cy.uploadContent(user, new Blob(), 'text/plain', '/and.txt')
  14. cy.login(user)
  15. cy.visit('/apps/files/')
  16. })
  17. })
  18. it('Can reanme to a file name containing XML entities', () => {
  19. cy.intercept('MOVE', /\/remote.php\/dav\/files\//).as('renameFile')
  20. triggerActionForFile('and.txt', 'rename')
  21. getRowForFile('and.txt')
  22. .find('form[aria-label="Rename file"] input')
  23. .type('{selectAll}&.txt{enter}')
  24. cy.wait('@renameFile')
  25. getRowForFile('&.txt').should('be.visible')
  26. })
  27. it('After a reload the filename is preserved', () => {
  28. cy.reload()
  29. getRowForFile('&.txt').should('be.visible')
  30. getRowForFile('&.txt').should('not.exist')
  31. })
  32. it('Can delete the file', () => {
  33. cy.intercept('DELETE', /\/remote.php\/dav\/files\//).as('deleteFile')
  34. triggerActionForFile('&.txt', 'delete')
  35. cy.wait('@deleteFile')
  36. cy.contains('.toast-success', /Delete .* successfull/)
  37. .should('be.visible')
  38. getRowForFile('&.txt').should('not.exist')
  39. cy.reload()
  40. getRowForFile('&.txt').should('not.exist')
  41. getRowForFile('&.txt').should('not.exist')
  42. })
  43. })