diff --git a/changelog/unreleased/bugfix-nocache-pl b/changelog/unreleased/bugfix-nocache-pl new file mode 100644 index 00000000000..c2249f062a0 --- /dev/null +++ b/changelog/unreleased/bugfix-nocache-pl @@ -0,0 +1,8 @@ +Bugfix: Do not load files from cache in public links + +When apps (i.e Drawio) try to load a file, the browser caches the request. +If the file was modified somewhere else, this causes inconsistent results which prevent saving any changes until the cache is properly cleared. +This had previously been fixed for normal files, but not yet for public links - which we took care of now. + +https://github.com/owncloud/web/pull/7811 +https://github.com/owncloud/web/pull/7075 diff --git a/packages/web-client/src/webdav/getFileContents.ts b/packages/web-client/src/webdav/getFileContents.ts index 1506156a5f8..2e119360dd0 100644 --- a/packages/web-client/src/webdav/getFileContents.ts +++ b/packages/web-client/src/webdav/getFileContents.ts @@ -13,16 +13,21 @@ export const GetFileContentsFactory = ({ sdk }: WebDavOptions) => { space: SpaceResource, { path }: { path?: string }, { - responseType = 'text' + responseType = 'text', + noCache = true }: { responseType?: 'arrayBuffer' | 'blob' | 'text' + noCache?: boolean } = {} ): Promise { if (isPublicSpaceResource(space)) { const res = await sdk.publicFiles.download( '', urlJoin(space.webDavPath.replace(/^\/public-files/, ''), path), - space.publicLinkPassword + space.publicLinkPassword, + { + noCache + } ) res.statusCode = res.status return { diff --git a/packages/web-pkg/src/composables/appDefaults/useAppFileHandling.ts b/packages/web-pkg/src/composables/appDefaults/useAppFileHandling.ts index 2288771a2fa..9aa7a8fca1f 100644 --- a/packages/web-pkg/src/composables/appDefaults/useAppFileHandling.ts +++ b/packages/web-pkg/src/composables/appDefaults/useAppFileHandling.ts @@ -43,7 +43,7 @@ export function useAppFileHandling({ } // TODO: support query parameters, possibly needs porting away from owncloud-sdk - const getFileContents = async ( + const getFileContents = ( fileContext: MaybeRef, options: { responseType?: 'arrayBuffer' | 'blob' | 'text' } & Record ) => { diff --git a/packages/web-runtime/package.json b/packages/web-runtime/package.json index c13482560de..0a4aef41f1a 100644 --- a/packages/web-runtime/package.json +++ b/packages/web-runtime/package.json @@ -13,7 +13,7 @@ "@uppy/tus": "^3.0.1", "@uppy/xhr-upload": "^3.0.1", "@vue/composition-api": "^1.6.2", - "axios": "^0.27.1", + "axios": "^0.27.2", "cross-fetch": "^3.0.6", "easygettext": "https://github.com/owncloud/easygettext/archive/refs/tags/v2.18.1-oc.tar.gz", "filesize": "^9.0.11", @@ -31,7 +31,7 @@ "portal-vue": "^2.1.7", "postcss-import": "^12.0.1", "postcss-url": "^9.0.0", - "promise": "^8.0.3", + "promise": "^8.1.0", "qs": "^6.10.3", "sanitize-html": "^2.7.0", "semver": "^7.3.7", @@ -54,7 +54,7 @@ "vuex-extensions": "^1.1.5", "vuex-router-sync": "^5.0.0", "web-pkg": "*", - "webdav": "4.10.0", + "webdav": "^4.10.0", "webfontloader": "^1.6.28", "xml-js": "^1.6.11" }, diff --git a/yarn.lock b/yarn.lock index 2a552c292a7..cb5d5162fe2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3509,7 +3509,7 @@ __metadata: languageName: node linkType: hard -"axios@npm:^0.27.1, axios@npm:^0.27.2": +"axios@npm:^0.27.2": version: 0.27.2 resolution: "axios@npm:0.27.2" dependencies: @@ -10815,7 +10815,7 @@ __metadata: languageName: node linkType: hard -"promise@npm:^8.0.3": +"promise@npm:^8.1.0": version: 8.1.0 resolution: "promise@npm:8.1.0" dependencies: @@ -13662,7 +13662,7 @@ __metadata: "@uppy/tus": ^3.0.1 "@uppy/xhr-upload": ^3.0.1 "@vue/composition-api": ^1.6.2 - axios: ^0.27.1 + axios: ^0.27.2 cross-fetch: ^3.0.6 easygettext: "https://github.com/owncloud/easygettext/archive/refs/tags/v2.18.1-oc.tar.gz" filesize: ^9.0.11 @@ -13680,7 +13680,7 @@ __metadata: portal-vue: ^2.1.7 postcss-import: ^12.0.1 postcss-url: ^9.0.0 - promise: ^8.0.3 + promise: ^8.1.0 qs: ^6.10.3 sanitize-html: ^2.7.0 semver: ^7.3.7 @@ -13703,13 +13703,13 @@ __metadata: vuex-extensions: ^1.1.5 vuex-router-sync: ^5.0.0 web-pkg: "*" - webdav: 4.10.0 + webdav: ^4.10.0 webfontloader: ^1.6.28 xml-js: ^1.6.11 languageName: unknown linkType: soft -"webdav@npm:4.10.0": +"webdav@npm:^4.10.0": version: 4.10.0 resolution: "webdav@npm:4.10.0" dependencies: