nextcloud / nextcloud/integration_google

Import job completely fails when the filename is too long (>256bytes on POSIX compliant filesystem)

Open
#365 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
JavaScript
Stars
142
Forks
40
PR merge metrics
No merged PRs in 30d

Description

Which version of integration_google are you using?

4.4.0

Which version of Nextcloud are you using?

34.0.4

Which browser are you using? In case you are using the phone App, specify the Android or iOS version and device please.

No response

Describe the Bug

Operating System: Linux 6.1.0-52-amd64 x86_64
Filesystem: ext4
php: 8.2.33

Bug:
Import job fails when the filename is too long for underlying server's filesystem
Log record:
Error: Google Drive import error: Unknown job failure. OCP\Files\NotPermittedException: Could not create folder "/user/files/Google Drive/Some_UTF8_symbols_Length_gt_256_bytes*************************************************************************************************************************************************************************" in /var/www/html/lib/private/Files/Node/Folder.php:142
Stack trace:
#0 /var/www/html/apps/integration_google/lib/Service/GoogleDriveAPIService.php(535): OC\Files\Node\Folder->newFolder()
#1 /var/www/html/apps/integration_google/lib/Service/GoogleDriveAPIService.php(318): OCA\Google\Service\GoogleDriveAPIService->createDirsUnder()
#2 /var/www/html/apps/integration_google/lib/Service/GoogleDriveAPIService.php(209): OCA\Google\Service\GoogleDriveAPIService->importFiles()
#3 /var/www/html/apps/integration_google/lib/BackgroundJob/ImportDriveJob.php(37): OCA\Google\Service\GoogleDriveAPIService->importDriveJob()
#4 /var/www/html/lib/public/BackgroundJob/Job.php(50): OCA\Google\BackgroundJob\ImportDriveJob->run()
#5 /var/www/html/lib/public/BackgroundJob/QueuedJob.php(31): OCP\BackgroundJob\Job->start()
#6 /var/www/html/core/Service/CronService.php(204): OCP\BackgroundJob\QueuedJob->start()
#7 /var/www/html/core/Service/CronService.php(107): OC\Core\Service\CronService->runCli()
#8 /var/www/html/cron.php(52): OC\Core\Service\CronService->run()
#9 {main}

Expected Behavior
Expectation

Import job continues and either skips the file, or cuts the name, or whatever. Either way it should not fail completely.

Some thoughts

Google Drive doesn't use server's filesystem and doesn't have its restrictions for filenames. Nextcloud does, so we need to handle these incompatibilites gracefully. And possibly give the user some insight of what was wrong at least. At most give him choice of how this error should be handled.

To Reproduce
  1. On connected google drive create file with name length greater than nextcloud server's filesystem allows.
  2. Start import job

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in apps/integration_google/lib/Service/GoogleDriveAPIService.php, especially createDirsUnder() and importFiles(), then trace the entry point in BackgroundJob/ImportDriveJob.php. Reproduce the import with a filename over 256 bytes on the stated POSIX filesystem. Done means the job no longer fails completely when folder creation is rejected, while the handling is visible to the user or otherwise follows the issue's expected skip or rename behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, php
Domain
backend, cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.