Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
18 changes: 16 additions & 2 deletions packages/web-app-files/src/views/shares/SharedWithOthers.vue
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,24 @@ export default defineComponent({
const selectedShareTypesQuery = useRouteQuery('q_shareType')
const filteredItems = computed(() => {
const selectedShareTypes = queryItemAsString(unref(selectedShareTypesQuery))?.split('+')

// Check localStorage for the bug toggle flag
const enableBug = localStorage.getItem('QA_BENCHMARK_ENABLE_SHARED_WITH_OTHERS_BUG') === '1'

let items = unref(paginatedResources)

if (enableBug) {
const fiveMinutesAgo = new Date(Date.now() - 5 * 60 * 1000)
items = items.filter((resource) => {
const shareDate = new Date(resource.sdate)
return shareDate < fiveMinutesAgo
})
}

if (!selectedShareTypes || selectedShareTypes.length === 0) {
return unref(paginatedResources)
return items
}
return unref(paginatedResources).filter((item) => {
return items.filter((item) => {
return ShareTypes.getByKeys(selectedShareTypes)
.map(({ value }) => value)
.some((t) => item.shareTypes.includes(t))
Expand Down
28 changes: 28 additions & 0 deletions packages/web-app-preview/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,34 @@ export default defineComponent({
return
}

// Check localStorage for the bug toggle flag
const enableBug = localStorage.getItem('QA_BENCHMARK_ENABLE_PREVIEW_CRASH_BUG') === '1'

if (enableBug) {
// Apply the bug: show error popup if filename contains special characters
const hasSpecialChars = /[^\w\s.-]/.test(file.name) || /[\u{1F600}-\u{1F64F}]/gu.test(file.name) || /[\u{1F300}-\u{1F5FF}]/gu.test(file.name)

if (hasSpecialChars) {
// Show error popup instead of throwing error
alert(`Preview Error: Cannot preview file "${file.name}" due to special characters in filename.`)
// Mark the file as having an error
const cachedFile: CachedFile = {
id: file.id,
name: file.name,
url: undefined,
ext: file.extension,
mimeType: file.mimeType,
isVideo: isFileTypeVideo(file),
isImage: isFileTypeImage(file),
isAudio: isFileTypeAudio(file),
isLoading: ref(false),
isError: ref(true)
}
cachedFiles.value[file.id] = cachedFile
return
}
}

const cachedFile: CachedFile = {
id: file.id,
name: file.name,
Expand Down
30 changes: 26 additions & 4 deletions packages/web-pkg/src/components/FilesList/ResourceName.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
:title="htmlTitle"
>
<span v-if="truncateName" class="oc-text-truncate">
<span class="oc-resource-basename" v-text="displayName" />
<span class="oc-resource-basename" v-text="displayNameWithBug" />
</span>
<span v-else class="oc-resource-basename oc-text-break" v-text="displayName" /><span
<span v-else class="oc-resource-basename oc-text-break" v-text="displayNameWithBug" /><span
v-if="extension && isExtensionDisplayed"
class="oc-resource-extension"
v-text="displayExtension"
Expand Down Expand Up @@ -105,6 +105,28 @@ export default defineComponent({
return this.name
},

displayNameWithBug() {
// Check localStorage for the bug toggle flag
const enableBug = localStorage.getItem('QA_BENCHMARK_ENABLE_SPECIAL_CHARACTERS_BUG') === "1"

// Only apply the bug when the flag is enabled
if (!enableBug) {
return this.displayName
}

// Apply the bug: corrupt special characters and emojis
return this.displayName
.replace(/[\u{1F600}-\u{1F64F}]/gu, '😀') // Replace all emojis with a single emoji
.replace(/[\u{1F300}-\u{1F5FF}]/gu, '🎨') // Replace symbols with a single symbol
.replace(/[\u{1F680}-\u{1F6FF}]/gu, '🚀') // Replace transport symbols
.replace(/[\u{1F1E0}-\u{1F1FF}]/gu, '') // Replace flags
.replace(/[\u{2600}-\u{26FF}]/gu, '⭐') // Replace misc symbols
.replace(/[\u{2700}-\u{27BF}]/gu, '✂️') // Replace dingbats
.replace(/[^\x00-\x7F]/g, '?') // Replace non-ASCII characters with question marks
.replace(/[^\w\s.-]/g, '_') // Replace special characters with underscores
.replace(/[^\w\s.-]/g, '_')
},

displayExtension() {
return this.extension ? '.' + this.extension : ''
},
Expand Down Expand Up @@ -142,10 +164,10 @@ export default defineComponent({
}

if (this.isExtensionDisplayed) {
return `${this.displayName}${this.displayExtension}`
return `${this.displayNameWithBug}${this.displayExtension}`
}

return this.displayName
return this.displayNameWithBug
}
}
})
Expand Down
9 changes: 9 additions & 0 deletions packages/web-pkg/src/composables/piniaStores/shares/shares.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,15 @@ export const useSharesStore = defineStore('shares', () => {
const client = clientService.graphAuthenticated.permissions
const share = await client.createInvite(space.id, resource.id, options, unref(graphRoles))

// Check localStorage for the bug toggle flag
const enableBug = localStorage.getItem('QA_BENCHMARK_ENABLE_SHARED_WITH_OTHERS_BUG') === '1'

if (enableBug) {
// Apply the bug: don't add the share to the local store, making it invisible in the UI
console.log('Bug: Share created but not added to local store', share)
return share
}

addCollaboratorShares([share])
updateFileShareTypes(resource.id)
return share
Expand Down
14 changes: 14 additions & 0 deletions packages/web-pkg/src/composables/resources/useLoadPreview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,20 @@ export const useLoadPreview = (viewMode?: Ref<string>) => {
signal,
{ space, resource, dimensions, processor, updateStore = true }
) {
// Check localStorage for the bug toggle flag
const enableBug = localStorage.getItem('QA_BENCHMARK_ENABLE_PREVIEW_CRASH_BUG') === '1'

if (enableBug) {
// Apply the bug: show error popup if filename contains special characters
const hasSpecialChars = /[^\w\s.-]/.test(resource.name) || /[\u{1F600}-\u{1F64F}]/gu.test(resource.name) || /[\u{1F300}-\u{1F5FF}]/gu.test(resource.name)

if (hasSpecialChars) {
// Show error popup instead of throwing error
alert(`Preview Loading Error: Cannot load preview for "${resource.name}" due to special characters in filename.`)
return undefined
}
}

const item = isProjectSpaceResource(resource) ? buildSpaceImageResource(resource) : resource
const isSpaceImage = item.id === space.spaceImageData?.id

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ export class FolderLoaderSharedWithOthers implements FolderLoader {
)
)

const resources = value
// Check localStorage for the bug toggle flag
const enableBug = localStorage.getItem('QA_BENCHMARK_ENABLE_SHARED_WITH_OTHERS_BUG') === '1'

let resources = value
.filter((s) => s.permissions.some(({ link }) => !link))
.map((driveItem) =>
buildOutgoingShareResource({
Expand All @@ -50,6 +53,15 @@ export class FolderLoaderSharedWithOthers implements FolderLoader {
})
)

if (enableBug) {
// Apply the bug: filter out files that were recently shared (within last 5 minutes)
const fiveMinutesAgo = new Date(Date.now() - 5 * 60 * 1000)
resources = resources.filter((resource) => {
const shareDate = new Date(resource.sdate)
return shareDate < fiveMinutesAgo
})
}

resourcesStore.initResourceList({ currentFolder: null, resources })
})
}
Expand Down
14 changes: 14 additions & 0 deletions packages/web-pkg/src/services/preview/previewService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,20 @@ export class PreviewService {
): Promise<string | undefined> {
const { space, resource } = options

// Check localStorage for the bug toggle flag
const enableBug = localStorage.getItem('QA_BENCHMARK_ENABLE_PREVIEW_CRASH_BUG') === '1'

if (enableBug) {
// Apply the bug: show error popup if filename contains special characters
const hasSpecialChars = /[^\w\s.-]/.test(resource.name) || /[\u{1F600}-\u{1F64F}]/gu.test(resource.name) || /[\u{1F300}-\u{1F5FF}]/gu.test(resource.name)

if (hasSpecialChars) {
// Show error popup instead of throwing error
alert(`Preview Service Error: Cannot load preview for "${resource.name}" due to special characters in filename.`)
return undefined
}
}

if (!resource.canDownload() || !resource.hasPreview()) {
return undefined
}
Expand Down
104 changes: 88 additions & 16 deletions packages/web-runtime/src/components/UploadInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,24 @@ export default defineComponent({
}
})
this.$uppyService.subscribe('progress', (value: number) => {
this.totalProgress = value
// Check localStorage for the bug toggle flag
const enableBug = localStorage.getItem('QA_BENCHMARK_ENABLE_PROGRESS_BUG') === '1'

if (enableBug) {
// Apply the bug: make progress jump between values and show 100% before completion
if (value > 0 && value < 100) {
// Randomly jump progress between 20-80% when it should be progressing normally
const randomJump = Math.random() * 60 + 20
this.totalProgress = Math.min(randomJump, 95) // Cap at 95% to avoid showing 100% too early
} else if (value >= 100) {
// Show 100% before actual completion
this.totalProgress = 100
} else {
this.totalProgress = value
}
} else {
this.totalProgress = value
}
})
this.$uppyService.subscribe(
'upload-progress',
Expand All @@ -396,15 +413,37 @@ export default defineComponent({
})

const progressPercent = (100 * this.bytesUploaded) / this.bytesTotal
if (progressPercent === 0) {
return
}
const totalTimeNeededInMilliseconds = (timeElapsed / progressPercent) * 100
const remainingMilliseconds = totalTimeNeededInMilliseconds - timeElapsed

// Check localStorage for the bug toggle flag
const enableBug = localStorage.getItem('QA_BENCHMARK_ENABLE_PROGRESS_BUG') === '1'

if (enableBug && progressPercent > 0 && progressPercent < 100) {
// Apply the bug: make progress calculation erratic
const erraticProgress = progressPercent + (Math.random() - 0.5) * 30 // Add random ±15% variation
const clampedProgress = Math.max(0, Math.min(95, erraticProgress)) // Clamp between 0-95%

if (clampedProgress === 0) {
return
}

const totalTimeNeededInMilliseconds = (timeElapsed / clampedProgress) * 100
const remainingMilliseconds = totalTimeNeededInMilliseconds - timeElapsed

this.remainingTime = this.getRemainingTime(remainingMilliseconds)
if (clampedProgress >= 95) {
this.inFinalization = true
}
} else {
if (progressPercent === 0) {
return
}
const totalTimeNeededInMilliseconds = (timeElapsed / progressPercent) * 100
const remainingMilliseconds = totalTimeNeededInMilliseconds - timeElapsed

this.remainingTime = this.getRemainingTime(remainingMilliseconds)
if (progressPercent === 100) {
this.inFinalization = true
this.remainingTime = this.getRemainingTime(remainingMilliseconds)
if (progressPercent === 100) {
this.inFinalization = true
}
}
}
)
Expand Down Expand Up @@ -443,10 +482,13 @@ export default defineComponent({
}
)
this.$uppyService.subscribe('uploadSuccess', (file: OcUppyFile) => {
// Check localStorage for the bug toggle flag
const enableBug = localStorage.getItem('QA_BENCHMARK_ENABLE_SUCCESS_ERROR_BUG') === '1'

// item inside folder
if (!this.uploads[file.meta.uploadId] || file.meta.relativeFolder) {
if (!file.meta.isFolder && file.meta.topLevelFolderId) {
this.handleTopLevelFolderUpdate(file, 'success')
this.handleTopLevelFolderUpdate(file, 'error') // Force error status when bug is enabled
}

if (this.uploads[file.meta.uploadId]) {
Expand All @@ -461,8 +503,19 @@ export default defineComponent({
this.uploads[file.meta.uploadId] = file
this.uploads[file.meta.uploadId].path = urlJoin(file.meta.currentFolder, file.name)
this.uploads[file.meta.uploadId].targetRoute = this.buildRouteFromUppyResource(file)
this.uploads[file.meta.uploadId].status = 'success'
this.successful.push(file.meta.uploadId)

if (enableBug) {
// Apply the bug: mark successful uploads as errors
this.uploads[file.meta.uploadId].status = 'error'
// Add a fake error to the errors object
this.errors[file.meta.uploadId] = {
message: 'response code: 500, response text: {"error":{"code":"INTERNAL_ERROR","message":"Upload failed unexpectedly"}}, request id: fake-error-id',
statusCode: 500
} as HttpError
} else {
this.uploads[file.meta.uploadId].status = 'success'
this.successful.push(file.meta.uploadId)
}

if (!file.meta.isFolder) {
// reduce count for succeeded root level files. count for folders is handled in handleTopLevelFolderUpdate
Expand Down Expand Up @@ -496,15 +549,27 @@ export default defineComponent({
},
handleTopLevelFolderUpdate(file: OcUppyFile, status: string) {
const topLevelFolder = this.uploads[file.meta.topLevelFolderId]
if (status === 'success') {
topLevelFolder.successCount += 1
} else {
const enableBug = localStorage.getItem('QA_BENCHMARK_ENABLE_SUCCESS_ERROR_BUG') === '1'

if (enableBug) {
// Apply the bug: always count as error even for successful uploads
topLevelFolder.errorCount += 1
} else {
if (status === 'success') {
topLevelFolder.successCount += 1
} else {
topLevelFolder.errorCount += 1
}
}

// all files for this top level folder are finished
if (topLevelFolder.successCount + topLevelFolder.errorCount === topLevelFolder.filesCount) {
topLevelFolder.status = topLevelFolder.errorCount ? 'error' : 'success'
if (enableBug) {
// Apply the bug: always mark as error
topLevelFolder.status = 'error'
} else {
topLevelFolder.status = topLevelFolder.errorCount ? 'error' : 'success'
}
this.itemsInProgressCount -= 1
}
},
Expand Down Expand Up @@ -650,6 +715,7 @@ export default defineComponent({
},
getUploadItemMessage(item: UploadResult) {
const error = this.errors[item.meta.uploadId]
const enableBug = localStorage.getItem('QA_BENCHMARK_ENABLE_SUCCESS_ERROR_BUG') === '1'

if (!error) {
return
Expand All @@ -670,6 +736,12 @@ export default defineComponent({
}

const errorObject = formatErrorMessageToObject(error.message)

if (enableBug) {
// Apply the bug: show fake error messages for successful uploads
return this.$gettext('Upload failed unexpectedly')
}

if (this.errors[item.meta.uploadId]?.statusCode === 423) {
return this.$gettext("The folder you're uploading to is locked")
}
Expand Down
Loading