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

[full-ci] Support noCache option for public links #7811

Merged
merged 5 commits into from
Oct 17, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions changelog/unreleased/bugfix-nocache-pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
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/7075
kulmann marked this conversation as resolved.
Show resolved Hide resolved
9 changes: 7 additions & 2 deletions packages/web-client/src/webdav/getFileContents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<GetFileContentsResponse> {
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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<FileContext>,
options: { responseType?: 'arrayBuffer' | 'blob' | 'text' } & Record<string, any>
) => {
Expand Down
6 changes: 3 additions & 3 deletions packages/web-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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"
},
Expand Down
12 changes: 6 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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:
Expand Down