Skip to content

Conversation

@DarkPhoenix2704
Copy link
Member

Change Summary

Closes #5207

Change type

  • feat: (new feature for the user, not a new feature for build script)

@DarkPhoenix2704 DarkPhoenix2704 self-assigned this Jul 9, 2024
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 9, 2024

Walkthrough

Walkthrough

The recent updates introduce a comprehensive thumbnail generation feature for uploaded images, significantly enhancing image handling across various modules. Key modifications include the addition of parameters to functions for improved thumbnail management, refinements to the upload process, and the implementation of new job types and processors leveraging the sharp library for efficient image processing. This streamlining optimizes file storage and retrieval capabilities within the system.

Changes

File(s) Change Summary
packages/nc-gui/composables/useAttachment.ts Added an optional thumbnail parameter to getPossibleAttachmentSrc for enhanced thumbnail handling.
packages/nocodb/.gitignore Included nc in the .gitignore to improve file management.
.../attachments-secure.controller.ts, .../attachments.controller.ts Integrated fs module, added file existence checks, and improved path construction for file access.
packages/nocodb/src/db/BaseModelSqlv2.ts Enhanced attachment handling with thumbnail path assignments and thumbnail generation logic.
packages/nocodb/src/interface/Jobs.ts Introduced AttachmentResType, new JobTypes, and ThumbnailGeneratorJobData interface.
.../fallback-queue.service.ts, .../jobs.module.ts Added ThumbnailGeneratorProcessor to effectively manage thumbnail generation jobs.
.../thumbnail-generator.processor.ts Developed ThumbnailGeneratorProcessor to handle thumbnail jobs utilizing the sharp library.
packages/nocodb/src/modules/noco.module.ts Streamlined module dependencies and controller configurations to align with new features.
.../plugins/.../*.ts Updated fileCreateByStream methods for improved asynchronous handling and structured responses.
packages/nocodb/src/services/attachments.service.ts Implemented image metadata extraction and thumbnail job creation logic.
packages/nocodb/src/services/public-datas.service.ts Enhanced handling of image dimensions and integrated thumbnail generation during uploads.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Frontend
    participant Backend
    participant JobsService
    participant ThumbnailProcessor
    
    User->>Frontend: Upload Image
    Frontend->>Backend: Send Image Upload Request
    Backend->>JobsService: Create Thumbnail Generation Job
    JobsService->>ThumbnailProcessor: Process Thumbnail Job
    ThumbnailProcessor->>Backend: Store Generated Thumbnails
    Backend->>Frontend: Return Upload Results
    Frontend->>User: Display Upload Confirmation
Loading

Assessment against linked issues

Objective Addressed Explanation
Implement a thumbnail generator for image uploads (#5207)
Ensure the system handles metadata extraction and thumbnail generation
Update file upload process to include image dimensions in metadata
Validate the presence of new job types and processors for thumbnail creation

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@DarkPhoenix2704
Copy link
Member Author

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 9, 2024

Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

Outside diff range and nitpick comments (1)
packages/nocodb/src/db/BaseModelSqlv2.ts (1)

Line range hint 7021-7035:
Add error handling for S3 thumbnail URL generation.

The code for generating S3 thumbnail URLs does not handle potential errors from PresignedUrl.getSignedUrl(). Consider adding error handling to ensure robustness.

if (lookedUpAttachment.url.includes('.amazonaws.com/')) {
  try {
    let relativePath = decodeURI(
      lookedUpAttachment.url.split('.amazonaws.com/')[1],
    );
    lookedUpAttachment.signedUrl = await PresignedUrl.getSignedUrl({
      path: relativePath,
      s3: true,
    });

    relativePath = relativePath.replace(
      'nc/uploads/noco',
      'nc/uploads/thumbnails',
    );

    lookedUpAttachment.thumbnails = {
      tiny: {},
      small: {},
      card_cover: {},
    };
    lookedUpAttachment.thumbnails.tiny.signedUrl = await PresignedUrl.getSignedUrl({
      path: `${relativePath}/tiny.jpg`,
      s3: true,
    });
    lookedUpAttachment.thumbnails.small.signedUrl = await PresignedUrl.getSignedUrl({
      path: `${relativePath}/small.jpg`,
      s3: true,
    });
    lookedUpAttachment.thumbnails.card_cover.signedUrl = await PresignedUrl.getSignedUrl({
      path: `${relativePath}/card_cover.jpg`,
      s3: true,
    });
  } catch (error) {
    logger.error(`Error generating S3 thumbnail URLs: ${error.message}`);
  }
}
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 1fc030e and 3f9178c.

Files selected for processing (15)
  • packages/nc-gui/components/cell/attachment/Image.vue (1 hunks)
  • packages/nc-gui/components/cell/attachment/index.vue (1 hunks)
  • packages/nc-gui/components/smartsheet/Gallery.vue (1 hunks)
  • packages/nc-gui/composables/useAttachment.ts (1 hunks)
  • packages/nocodb/src/db/BaseModelSqlv2.ts (3 hunks)
  • packages/nocodb/src/interface/Jobs.ts (3 hunks)
  • packages/nocodb/src/modules/jobs/fallback/fallback-queue.service.ts (3 hunks)
  • packages/nocodb/src/modules/jobs/jobs.module.ts (6 hunks)
  • packages/nocodb/src/modules/jobs/jobs/at-import/at-import.processor.ts (2 hunks)
  • packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/attachments-secure.controller.ts (1 hunks)
  • packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/attachments.controller.ts (1 hunks)
  • packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/attachments.service.ts (4 hunks)
  • packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/thumbnail-generator.processor.ts (1 hunks)
  • packages/nocodb/src/modules/noco.module.ts (7 hunks)
  • packages/nocodb/src/plugins/s3/S3.ts (1 hunks)
Additional comments not posted (29)
packages/nc-gui/components/cell/attachment/Image.vue (1)

11-13: LGTM!

The onError function correctly updates index.value using Vue's reactivity system.

packages/nc-gui/composables/useAttachment.ts (1)

4-9: LGTM!

The changes to getPossibleAttachmentSrc correctly handle the optional thumbnail parameter and update the logic to include thumbnails.

packages/nocodb/src/interface/Jobs.ts (1)

20-20: LGTM!

The additions to the JobTypes enum and the ThumbnailGeneratorJobData interface are correct and adhere to best practices.

Also applies to: 125-128

packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/attachments-secure.controller.ts (1)

22-22: LGTM!

The import path for AttachmentsService has been correctly updated.

packages/nocodb/src/modules/jobs/jobs.module.ts (5)

3-4: Imports for MulterModule and multer look correct.

The imports are necessary for handling file uploads and are correctly added.


23-25: Imports for ThumbnailGeneratorProcessor, AttachmentsSecureController, and AttachmentsController look correct.

These imports are necessary for handling thumbnail generation and secure attachment uploads.


38-38: Import for AttachmentsService looks correct.

The import is necessary for handling attachment-related operations.


44-49: MulterModule registration looks correct.

The MulterModule is registered with appropriate configurations for storage and limits.


Line range hint 87-100:
Additions of AttachmentsService and ThumbnailGeneratorProcessor look correct.

These additions are necessary for handling attachment-related operations and thumbnail generation.

packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/attachments.controller.ts (1)

21-21: Import for AttachmentsService looks correct.

The import is necessary for handling attachment-related operations.

packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/thumbnail-generator.processor.ts (7)

1-13: Imports for AttachmentsService, sharp, axios, and other dependencies look correct.

These imports are necessary for handling thumbnail generation and related operations.


15-17: ThumbnailGeneratorProcessor class definition and constructor look correct.

The class is correctly defined to process thumbnail generation jobs, with the AttachmentsService correctly initialized in the constructor.


21-34: job method implementation looks correct.

The method correctly processes jobs to generate thumbnails for image attachments and handles errors appropriately.


36-144: generateThumbnail method implementation looks correct.

The method correctly generates thumbnails for image attachments using sharp and handles various scenarios for obtaining the file.


139-143: Logging and error handling in generateThumbnail method look correct.

The logging and error handling are correctly implemented and provide useful information during failures.


122-127: Usage of sharp for image processing looks correct.

The usage of sharp is correctly implemented and optimized for resizing images to generate thumbnails.


62-63: Usage of axios for fetching files looks correct.

The usage of axios is correctly implemented and handles errors appropriately.

packages/nocodb/src/plugins/s3/S3.ts (1)

78-83: fileCreateByStream method implementation looks correct.

The method correctly handles file creation by stream asynchronously using promises and handles errors appropriately.

packages/nocodb/src/modules/jobs/fallback/fallback-queue.service.ts (3)

13-13: New Import: ThumbnailGeneratorProcessor

The ThumbnailGeneratorProcessor class is imported to handle thumbnail generation jobs.


39-39: New Processor: ThumbnailGeneratorProcessor

The ThumbnailGeneratorProcessor is added as a protected member of the QueueService class.


105-108: New Job Type: ThumbnailGenerator

A new job type ThumbnailGenerator is added to the job map, linking it to the thumbnailGeneratorProcessor.

packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/attachments.service.ts (4)

18-20: New Imports: Job-related services and types

The IJobsService, JobTypes, and RootScopes are imported to facilitate job handling.


26-30: Updated Constructor: Added jobsService

The constructor now includes an additional jobsService parameter, injected using forwardRef to avoid circular dependencies.


123-131: New Job Addition: ThumbnailGenerator in upload method

A new job of type ThumbnailGenerator is added to the jobs service within the upload method to handle thumbnail generation for uploaded files.


213-221: New Job Addition: ThumbnailGenerator in uploadViaURL method

A new job of type ThumbnailGenerator is added to the jobs service within the uploadViaURL method to handle thumbnail generation for files uploaded via URL.

packages/nocodb/src/modules/noco.module.ts (1)

121-121: Simplified Module Metadata: Removed multer and MulterModule

The references to multer and MulterModule are removed, simplifying the module metadata.

packages/nc-gui/components/cell/attachment/index.vue (1)

303-303: Modified Function Call: getPossibleAttachmentSrc

The getPossibleAttachmentSrc function call is modified to include an additional argument for handling different image sizes ('card_cover' and 'tiny').

packages/nc-gui/components/smartsheet/Gallery.vue (1)

307-307: LGTM! The change to include 'card_cover' looks good.

The addition of the 'card_cover' argument to getPossibleAttachmentSrc is consistent with the PR's objective to handle different image sizes.

packages/nocodb/src/modules/jobs/jobs/at-import/at-import.processor.ts (1)

21-21: Verify the necessity and correctness of the AttachmentsService import.

Ensure that AttachmentsService from the thumbnail-generator module is correctly used within the file. If it is not used, consider removing the import to avoid unnecessary dependencies.

@o1lab o1lab force-pushed the nc-thumbnail-processor branch 4 times, most recently from 1fb39eb to ded0520 Compare July 10, 2024 07:25
@DarkPhoenix2704 DarkPhoenix2704 marked this pull request as ready for review July 10, 2024 07:28
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. 🔦 Type: Feature New functionality is requested. labels Jul 10, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 8

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 3f9178c and ded0520.

Files selected for processing (25)
  • packages/nc-gui/components/cell/attachment/Image.vue (1 hunks)
  • packages/nc-gui/components/cell/attachment/index.vue (1 hunks)
  • packages/nc-gui/components/smartsheet/Gallery.vue (1 hunks)
  • packages/nc-gui/composables/useAttachment.ts (1 hunks)
  • packages/nocodb/.gitignore (1 hunks)
  • packages/nocodb/src/db/BaseModelSqlv2.ts (2 hunks)
  • packages/nocodb/src/interface/Jobs.ts (3 hunks)
  • packages/nocodb/src/modules/jobs/fallback/fallback-queue.service.ts (3 hunks)
  • packages/nocodb/src/modules/jobs/jobs.module.ts (6 hunks)
  • packages/nocodb/src/modules/jobs/jobs/at-import/at-import.processor.ts (2 hunks)
  • packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/attachments-secure.controller.ts (2 hunks)
  • packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/attachments.controller.ts (2 hunks)
  • packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/attachments.service.ts (4 hunks)
  • packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/thumbnail-generator.processor.ts (1 hunks)
  • packages/nocodb/src/modules/noco.module.ts (7 hunks)
  • packages/nocodb/src/plugins/backblaze/Backblaze.ts (1 hunks)
  • packages/nocodb/src/plugins/gcs/Gcs.ts (1 hunks)
  • packages/nocodb/src/plugins/linode/LinodeObjectStorage.ts (1 hunks)
  • packages/nocodb/src/plugins/mino/Minio.ts (1 hunks)
  • packages/nocodb/src/plugins/ovhCloud/OvhCloud.ts (1 hunks)
  • packages/nocodb/src/plugins/s3/S3.ts (1 hunks)
  • packages/nocodb/src/plugins/scaleway/ScalewayObjectStorage.ts (1 hunks)
  • packages/nocodb/src/plugins/spaces/Spaces.ts (1 hunks)
  • packages/nocodb/src/plugins/upcloud/UpoCloud.ts (1 hunks)
  • packages/nocodb/src/plugins/vultr/Vultr.ts (1 hunks)
Files skipped from review due to trivial changes (2)
  • packages/nocodb/.gitignore
  • packages/nocodb/src/interface/Jobs.ts
Files skipped from review as they are similar to previous changes (12)
  • packages/nc-gui/components/cell/attachment/Image.vue
  • packages/nc-gui/components/cell/attachment/index.vue
  • packages/nc-gui/composables/useAttachment.ts
  • packages/nocodb/src/db/BaseModelSqlv2.ts
  • packages/nocodb/src/modules/jobs/fallback/fallback-queue.service.ts
  • packages/nocodb/src/modules/jobs/jobs.module.ts
  • packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/attachments-secure.controller.ts
  • packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/attachments.controller.ts
  • packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/attachments.service.ts
  • packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/thumbnail-generator.processor.ts
  • packages/nocodb/src/modules/noco.module.ts
  • packages/nocodb/src/plugins/s3/S3.ts
Additional comments not posted (5)
packages/nocodb/src/plugins/linode/LinodeObjectStorage.ts (1)

81-99: Ensure proper error handling and return type consistency.

The fileCreateByStream method correctly handles asynchronous file uploads using promises. However, the return type in the method signature is Promise<any>, which is consistent with the resolved value. The method looks good overall.

packages/nocodb/src/plugins/scaleway/ScalewayObjectStorage.ts (1)

131-149: Ensure proper error handling and return type consistency.

The fileCreateByStream method correctly handles asynchronous file uploads using promises. However, the return type in the method signature is Promise<any>, which is consistent with the resolved value. The method looks good overall.

packages/nocodb/src/plugins/mino/Minio.ts (1)

138-141: Verify if the metadata object should be populated.

The metadata object is currently empty. Confirm if this is intentional or if it should contain specific metadata.

packages/nocodb/src/modules/jobs/jobs/at-import/at-import.processor.ts (2)

21-21: New Import: AttachmentsService

The AttachmentsService has been imported. Ensure that it is used correctly in the code.

Verification successful

Verified Import Usage: AttachmentsService

The AttachmentsService import in packages/nocodb/src/modules/jobs/jobs/at-import/at-import.processor.ts is correctly utilized within the file.

  • The attachmentsService is instantiated and used in the file, confirming the necessity of the import.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `AttachmentsService` in the file.

# Test: Search for the usage of `AttachmentsService`. Expect: Occurrences of `attachmentsService`.
rg --type ts 'attachmentsService'

Length of output: 2745


Ensure Proper Error Handling for Attachment Uploads

The attachmentsService.uploadViaURL method is used to upload attachments in the following files:

  • packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/attachments.controller.ts
  • packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/attachments-secure.controller.ts
  • packages/nocodb/src/modules/jobs/jobs/at-import/at-import.processor.ts

Currently, these calls are not wrapped in try-catch blocks or any other error handling mechanisms. It is recommended to implement proper error handling to avoid potential issues during the upload process.

  • Wrap attachmentsService.uploadViaURL calls in try-catch blocks or implement other appropriate error handling mechanisms.
Analysis chain

Line range hint 565-577:
Ensure Proper Error Handling for Attachment Uploads

The attachmentsService.uploadViaURL method is used to upload attachments. Ensure that errors are handled appropriately to avoid potential issues during the upload process.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the error handling for `attachmentsService.uploadViaURL`.

# Test: Search for error handling code around `attachmentsService.uploadViaURL`. Expect: Proper error handling mechanisms.
rg --type ts -A 5 'attachmentsService.uploadViaURL'

Length of output: 2072


Script:

#!/bin/bash
# Description: Verify the error handling for `attachmentsService.uploadViaURL` in the identified files.

# Search for `try-catch` blocks around `attachmentsService.uploadViaURL` in `attachments.controller.ts`
rg --type ts -A 10 'try' packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/attachments.controller.ts

# Search for `try-catch` blocks around `attachmentsService.uploadViaURL` in `attachments-secure.controller.ts`
rg --type ts -A 10 'try' packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/attachments-secure.controller.ts

# Search for `try-catch` blocks around `attachmentsService.uploadViaURL` in `at-import.processor.ts`
rg --type ts -A 10 'try' packages/nocodb/src/modules/jobs/jobs/at-import/at-import.processor.ts

Length of output: 6067


Script:

#!/bin/bash
# Description: Verify the error handling for `attachmentsService.uploadViaURL` in the identified files.

# Check if `attachmentsService.uploadViaURL` is inside a try-catch block in `attachments.controller.ts`
rg --type ts -A 5 -B 5 'attachmentsService.uploadViaURL' packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/attachments.controller.ts

# Check if `attachmentsService.uploadViaURL` is inside a try-catch block in `attachments-secure.controller.ts`
rg --type ts -A 5 -B 5 'attachmentsService.uploadViaURL' packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/attachments-secure.controller.ts

# Check if `attachmentsService.uploadViaURL` is inside a try-catch block in `at-import.processor.ts`
rg --type ts -A 5 -B 5 'attachmentsService.uploadViaURL' packages/nocodb/src/modules/jobs/jobs/at-import/at-import.processor.ts

Length of output: 1446

@o1lab o1lab force-pushed the nc-thumbnail-processor branch from ded0520 to e4c5107 Compare July 10, 2024 07:44
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between ded0520 and e4c5107.

Files selected for processing (25)
  • packages/nc-gui/components/cell/attachment/Image.vue (1 hunks)
  • packages/nc-gui/components/cell/attachment/index.vue (1 hunks)
  • packages/nc-gui/components/smartsheet/Gallery.vue (1 hunks)
  • packages/nc-gui/composables/useAttachment.ts (1 hunks)
  • packages/nocodb/.gitignore (1 hunks)
  • packages/nocodb/src/db/BaseModelSqlv2.ts (2 hunks)
  • packages/nocodb/src/interface/Jobs.ts (3 hunks)
  • packages/nocodb/src/modules/jobs/fallback/fallback-queue.service.ts (3 hunks)
  • packages/nocodb/src/modules/jobs/jobs.module.ts (6 hunks)
  • packages/nocodb/src/modules/jobs/jobs/at-import/at-import.processor.ts (2 hunks)
  • packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/attachments-secure.controller.ts (2 hunks)
  • packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/attachments.controller.ts (2 hunks)
  • packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/attachments.service.ts (4 hunks)
  • packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/thumbnail-generator.processor.ts (1 hunks)
  • packages/nocodb/src/modules/noco.module.ts (7 hunks)
  • packages/nocodb/src/plugins/backblaze/Backblaze.ts (1 hunks)
  • packages/nocodb/src/plugins/gcs/Gcs.ts (1 hunks)
  • packages/nocodb/src/plugins/linode/LinodeObjectStorage.ts (1 hunks)
  • packages/nocodb/src/plugins/mino/Minio.ts (1 hunks)
  • packages/nocodb/src/plugins/ovhCloud/OvhCloud.ts (1 hunks)
  • packages/nocodb/src/plugins/s3/S3.ts (1 hunks)
  • packages/nocodb/src/plugins/scaleway/ScalewayObjectStorage.ts (1 hunks)
  • packages/nocodb/src/plugins/spaces/Spaces.ts (1 hunks)
  • packages/nocodb/src/plugins/upcloud/UpoCloud.ts (1 hunks)
  • packages/nocodb/src/plugins/vultr/Vultr.ts (1 hunks)
Files skipped from review due to trivial changes (1)
  • packages/nocodb/src/plugins/spaces/Spaces.ts
Files skipped from review as they are similar to previous changes (20)
  • packages/nc-gui/components/cell/attachment/Image.vue
  • packages/nc-gui/components/cell/attachment/index.vue
  • packages/nc-gui/components/smartsheet/Gallery.vue
  • packages/nocodb/.gitignore
  • packages/nocodb/src/db/BaseModelSqlv2.ts
  • packages/nocodb/src/interface/Jobs.ts
  • packages/nocodb/src/modules/jobs/fallback/fallback-queue.service.ts
  • packages/nocodb/src/modules/jobs/jobs.module.ts
  • packages/nocodb/src/modules/jobs/jobs/at-import/at-import.processor.ts
  • packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/attachments-secure.controller.ts
  • packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/attachments.controller.ts
  • packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/thumbnail-generator.processor.ts
  • packages/nocodb/src/plugins/backblaze/Backblaze.ts
  • packages/nocodb/src/plugins/gcs/Gcs.ts
  • packages/nocodb/src/plugins/linode/LinodeObjectStorage.ts
  • packages/nocodb/src/plugins/mino/Minio.ts
  • packages/nocodb/src/plugins/s3/S3.ts
  • packages/nocodb/src/plugins/scaleway/ScalewayObjectStorage.ts
  • packages/nocodb/src/plugins/upcloud/UpoCloud.ts
  • packages/nocodb/src/plugins/vultr/Vultr.ts
Additional comments not posted (8)
packages/nc-gui/composables/useAttachment.ts (3)

4-9: Add comments for clarity and verify nested function call.

The getPossibleAttachmentSrc function now handles different thumbnail sizes, which is a good enhancement. However, adding comments to explain the logic would improve readability. Also, verify that the nested call to getPossibleAttachmentSrc does not lead to infinite recursion.

[nitpick, verify]

  const getPossibleAttachmentSrc = (item: Record<string, any>, thumbnail?: 'card_cover' | 'tiny' | 'small') => {
+    // Initialize an empty array to store possible attachment sources
    const res: string[] = []

    if (thumbnail && item?.thumbnails && item.thumbnails[thumbnail]) {
+      // Add the thumbnail source to the result array
      res.push(getPossibleAttachmentSrc(item.thumbnails[thumbnail])[0])
    }
    if (item?.data) res.push(item.data)
    if (item?.file) res.push(window.URL.createObjectURL(item.file))
    if (item?.signedPath) res.push(`${appInfo.value.ncSiteUrl}/${encodeURI(item.signedPath)}`)
    if (item?.signedUrl) res.push(item.signedUrl)
    if (item?.path) res.push(`${appInfo.value.ncSiteUrl}/${encodeURI(item.path)}`)
    if (item?.url) res.push(item.url)
    return res
  }

Line range hint 11-23: LGTM!

The getAttachmentSrc function handles errors gracefully and returns the first accessible source.


Line range hint 25-27: LGTM!

The openAttachment function is straightforward and correct.

packages/nocodb/src/plugins/ovhCloud/OvhCloud.ts (3)

81-102: Refactor fileCreateByStream method and add error handling.

The method can be simplified by removing the unnecessary promise wrapper and adding error handling for stream errors.
[refactor_suggestion, duplicate_comment]

  async fileCreateByStream(key: string, stream: Readable): Promise<void> {
    const uploadParams: any = {
      ACL: 'public-read',
      Body: stream,
      Key: key,
    };

    try {
      stream.on('error', (err) => {
        console.log('Stream Error', err);
        throw err;
      });

      const data = await this.s3Client.upload(uploadParams).promise();
      return data.Location;
    } catch (err) {
      console.log('Error', err);
      throw err;
    }
  }

Line range hint 104-106: Skip placeholder function fileReadByStream.

The function is not implemented yet.


Line range hint 108-110: Skip placeholder function getDirectoryList.

The function is not implemented yet.

packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/attachments.service.ts (1)

Line range hint 223-235: LGTM!

The getFile function is straightforward and correct.

packages/nocodb/src/modules/noco.module.ts (1)

4-5: LGTM!

The changes in the module metadata are correct and necessary for the new thumbnail generation functionality.

Also applies to: 121-126

@o1lab o1lab force-pushed the nc-thumbnail-processor branch from e4c5107 to 15e8f96 Compare July 10, 2024 08:00
@DarkPhoenix2704 DarkPhoenix2704 marked this pull request as draft July 10, 2024 08:06
@o1lab o1lab force-pushed the nc-thumbnail-processor branch 8 times, most recently from 396b1be to 522cd39 Compare July 11, 2024 12:48
@dstala dstala marked this pull request as ready for review July 16, 2024 10:25
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

Outside diff range, codebase verification and nitpick comments (1)
packages/nocodb/src/modules/noco.module.ts (1)

121-121: Removed attachment size constant import.

The import of NC_ATTACHMENT_FIELD_SIZE was removed from packages/nocodb/src/modules/noco.module.ts, but the constant is still being used in the codebase. Please ensure that the import is restored or the usage of the constant is updated accordingly.

  • packages/nocodb/src/modules/noco.module.ts
  • packages/nocodb/src/modules/jobs/jobs.module.ts
  • packages/nocodb/src/services/utils.service.ts
Analysis chain

Removed attachment size constant import.

The removal of NC_ATTACHMENT_FIELD_SIZE import needs verification to ensure that the constant is no longer used or has been relocated.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of NC_ATTACHMENT_FIELD_SIZE in the codebase.

# Test: Search for the usage of NC_ATTACHMENT_FIELD_SIZE.
rg --type python -A 5 $'NC_ATTACHMENT_FIELD_SIZE'

Length of output: 79


Script:

#!/bin/bash
# Description: Verify the usage of NC_ATTACHMENT_FIELD_SIZE in the codebase.

# Test: Search for the usage of NC_ATTACHMENT_FIELD_SIZE in TypeScript and JavaScript files.
rg 'NC_ATTACHMENT_FIELD_SIZE' --type js --type ts -A 5

Length of output: 3185

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e4c5107 and 522cd39.

Files selected for processing (31)
  • packages/nc-gui/components/cell/attachment/Image.vue (1 hunks)
  • packages/nc-gui/components/cell/attachment/Modal.vue (1 hunks)
  • packages/nc-gui/components/cell/attachment/index.vue (2 hunks)
  • packages/nc-gui/components/smartsheet/Gallery.vue (1 hunks)
  • packages/nc-gui/components/smartsheet/Kanban.vue (1 hunks)
  • packages/nc-gui/components/smartsheet/calendar/SideMenu.vue (1 hunks)
  • packages/nc-gui/components/virtual-cell/components/ListItem.vue (1 hunks)
  • packages/nc-gui/composables/useAttachment.ts (1 hunks)
  • packages/nocodb/.gitignore (1 hunks)
  • packages/nocodb/src/db/BaseModelSqlv2.ts (3 hunks)
  • packages/nocodb/src/interface/Jobs.ts (3 hunks)
  • packages/nocodb/src/modules/jobs/fallback/fallback-queue.service.ts (3 hunks)
  • packages/nocodb/src/modules/jobs/jobs.module.ts (6 hunks)
  • packages/nocodb/src/modules/jobs/jobs/at-import/at-import.processor.ts (2 hunks)
  • packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/attachments-secure.controller.ts (3 hunks)
  • packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/attachments.controller.ts (5 hunks)
  • packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/attachments.service.ts (9 hunks)
  • packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/thumbnail-generator.processor.ts (1 hunks)
  • packages/nocodb/src/modules/noco.module.ts (7 hunks)
  • packages/nocodb/src/plugins/backblaze/Backblaze.ts (2 hunks)
  • packages/nocodb/src/plugins/gcs/Gcs.ts (2 hunks)
  • packages/nocodb/src/plugins/linode/LinodeObjectStorage.ts (2 hunks)
  • packages/nocodb/src/plugins/mino/Minio.ts (2 hunks)
  • packages/nocodb/src/plugins/ovhCloud/OvhCloud.ts (2 hunks)
  • packages/nocodb/src/plugins/s3/S3.ts (1 hunks)
  • packages/nocodb/src/plugins/scaleway/ScalewayObjectStorage.ts (2 hunks)
  • packages/nocodb/src/plugins/spaces/Spaces.ts (2 hunks)
  • packages/nocodb/src/plugins/storage/Local.ts (2 hunks)
  • packages/nocodb/src/plugins/upcloud/UpoCloud.ts (2 hunks)
  • packages/nocodb/src/plugins/vultr/Vultr.ts (2 hunks)
  • packages/nocodb/src/services/public-datas.service.ts (7 hunks)
Files skipped from review as they are similar to previous changes (18)
  • packages/nc-gui/components/cell/attachment/Image.vue
  • packages/nc-gui/components/cell/attachment/index.vue
  • packages/nc-gui/components/smartsheet/Gallery.vue
  • packages/nc-gui/composables/useAttachment.ts
  • packages/nocodb/.gitignore
  • packages/nocodb/src/interface/Jobs.ts
  • packages/nocodb/src/modules/jobs/fallback/fallback-queue.service.ts
  • packages/nocodb/src/modules/jobs/jobs.module.ts
  • packages/nocodb/src/modules/jobs/jobs/at-import/at-import.processor.ts
  • packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/attachments-secure.controller.ts
  • packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/attachments.service.ts
  • packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/thumbnail-generator.processor.ts
  • packages/nocodb/src/plugins/backblaze/Backblaze.ts
  • packages/nocodb/src/plugins/gcs/Gcs.ts
  • packages/nocodb/src/plugins/mino/Minio.ts
  • packages/nocodb/src/plugins/scaleway/ScalewayObjectStorage.ts
  • packages/nocodb/src/plugins/spaces/Spaces.ts
  • packages/nocodb/src/plugins/upcloud/UpoCloud.ts
Additional context used
Biome
packages/nocodb/src/plugins/s3/S3.ts

[error] 77-77: The catch clause that only rethrows the original error is redundant.

These unnecessary catch clauses can be confusing. It is recommended to remove them.

(lint/complexity/noUselessCatch)

Additional comments not posted (14)
packages/nocodb/src/plugins/vultr/Vultr.ts (1)

84-102: Refactor of fileCreateByStream to use async/await.

The method has been refactored to use async/await, which improves readability and error handling. However, the previous comment about ensuring proper error handling and return type consistency still applies.

packages/nocodb/src/plugins/linode/LinodeObjectStorage.ts (1)

84-101: Updated fileCreateByStream with async/await and improved error handling.

The method now uses async/await, which simplifies the handling of asynchronous operations. The change should improve the reliability and readability of the code.

However, ensure that the error handling is robust enough to manage potential issues with network or S3 operations.

Verification successful

Updated fileCreateByStream with async/await and improved error handling.

The method now uses async/await, which simplifies the handling of asynchronous operations. The change should improve the reliability and readability of the code. However, ensure that the error handling is robust enough to manage potential issues with network or S3 operations.

  • LinodeObjectStorage.ts: Uses a promise with resolve and reject inside the s3Client.upload callback.
  • S3.ts: Uses a promise with resolve and reject inside the this.upload method.
  • Minio.ts: Uses a promise with resolve and reject inside the upload logic.

The error handling in LinodeObjectStorage.ts appears consistent with other similar implementations.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify error handling in fileCreateByStream method across similar implementations in the codebase.

rg --type python -A 5 $'fileCreateByStream'

Length of output: 73


Script:

#!/bin/bash
# Description: Verify error handling in fileCreateByStream method across similar implementations in the codebase.

rg --type typescript -A 5 $'fileCreateByStream'

Length of output: 81


Script:

#!/bin/bash
# Description: Verify error handling in fileCreateByStream method across similar implementations in the codebase.

rg -A 5 $'fileCreateByStream'

Length of output: 9834

packages/nocodb/src/plugins/ovhCloud/OvhCloud.ts (1)

84-105: Optimization and error handling in fileCreateByStream.

The method has been optimized to use async/await, enhancing the handling of asynchronous operations and simplifying the code. The previous comments about optimizing the method and adding error handling are still relevant.

packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/attachments.controller.ts (1)

22-22: Updated import path for AttachmentsService

The import path for AttachmentsService has been updated to reflect its new location. This is a straightforward change, but it's crucial to ensure that all references to this service within the file are updated accordingly.

packages/nocodb/src/plugins/s3/S3.ts (1)

81-86: Refactor of fileCreateByStream using async/await

The method fileCreateByStream has been refactored to use async/await for better readability and error handling. This change should help in managing asynchronous operations more effectively.

However, ensure that the error handling is robust and that all possible errors are appropriately caught and handled.

Verification successful

Refactor of fileCreateByStream using async/await

The method fileCreateByStream has been refactored to use async/await for better readability and error handling. This change should help in managing asynchronous operations more effectively.

  • The method correctly handles errors by rejecting the promise in case of an error during the upload process.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify error handling in fileCreateByStream method.

# Test: Search for error handling patterns. Expect: Robust error handling.
rg --type typescript -A 5 $'fileCreateByStream'

Length of output: 81


Script:

#!/bin/bash
# Description: Verify error handling in fileCreateByStream method.

# Test: Search for error handling patterns. Expect: Robust error handling.
rg 'fileCreateByStream' -A 10 --glob '*.ts'

Length of output: 17730

packages/nc-gui/components/cell/attachment/Modal.vue (1)

149-149: Updated argument in getPossibleAttachmentSrc call

The getPossibleAttachmentSrc function now receives an additional argument 'card_cover' which likely affects how thumbnails are generated for attachments. This change should be tested thoroughly to ensure it integrates seamlessly with the existing functionality.

Verification successful

Updated argument in getPossibleAttachmentSrc call

The getPossibleAttachmentSrc function now consistently receives an additional argument (e.g., 'card_cover', 'tiny') across multiple files in the codebase. This indicates that the change is well-integrated and should not introduce any issues.

  • Verified consistent usage in:
    • packages/nc-gui/components/smartsheet/Form.vue
    • packages/nc-gui/components/smartsheet/calendar/SideMenu.vue
    • packages/nc-gui/components/virtual-cell/components/ListItem.vue
    • packages/nc-gui/components/smartsheet/Kanban.vue
    • packages/nc-gui/components/smartsheet/Gallery.vue
    • packages/nc-gui/components/general/FormBanner.vue
    • packages/nc-gui/components/cell/attachment/Carousel.vue
    • packages/nc-gui/components/cell/attachment/index.vue
    • packages/nc-gui/components/cell/attachment/Modal.vue
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify integration of getPossibleAttachmentSrc with new argument.

# Test: Search for usage of getPossibleAttachmentSrc in the project. Expect: Consistent usage of new argument.
rg --type vue -A 5 $'getPossibleAttachmentSrc'

Length of output: 73


Script:

#!/bin/bash
# Description: Verify integration of getPossibleAttachmentSrc with new argument.

# Test: Search for usage of getPossibleAttachmentSrc in the project. Expect: Consistent usage of new argument.
rg getPossibleAttachmentSrc -A 5

Length of output: 11526

packages/nc-gui/components/virtual-cell/components/ListItem.vue (1)

95-95: Updated argument in getPossibleAttachmentSrc call in ListItem.vue

The getPossibleAttachmentSrc function now receives an additional argument 'tiny' which likely affects how thumbnails are generated for list items. This change should be tested thoroughly to ensure it integrates seamlessly with the existing functionality.

Verification successful

Updated argument in getPossibleAttachmentSrc call in ListItem.vue

The getPossibleAttachmentSrc function now receives an additional argument 'tiny', which likely affects how thumbnails are generated for list items. This change is consistent with other usages in the codebase and should integrate seamlessly with the existing functionality.

  • packages/nc-gui/components/virtual-cell/components/ListItem.vue: Line 95
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify integration of getPossibleAttachmentSrc with new argument in ListItem.vue.

# Test: Search for usage of getPossibleAttachmentSrc in the project. Expect: Consistent usage of new argument.
rg --type vue -A 5 $'getPossibleAttachmentSrc'

Length of output: 73


Script:

#!/bin/bash
# Description: Verify integration of getPossibleAttachmentSrc with new argument in ListItem.vue.

# Test: Search for usage of getPossibleAttachmentSrc in the project. Expect: Consistent usage of new argument.
rg -A 5 'getPossibleAttachmentSrc'

Length of output: 11526

packages/nocodb/src/modules/noco.module.ts (2)

Line range hint 121-148: Significant changes in module metadata.

The module metadata has been significantly refactored:

  • Removed MulterModule configuration.
  • Adjusted controller imports based on environment variables.

These changes align with the removal of direct file handling in this module. Ensure that the conditional logic for controller imports is correctly implemented and tested.


4-5: Removed Multer and related imports.

The removal of MulterModule and multer suggests a refactoring or relocation of file handling logic. Ensure that this change is consistent with the new architecture for handling uploads and image processing as described in the PR summary.

packages/nocodb/src/services/public-datas.service.ts (3)

2-2: Added imports for image processing and job handling.

The addition of sharp for image processing and IJobsService for job handling are crucial for the new thumbnail generation feature. Ensure that these imports are used appropriately within the service.

Also applies to: 8-8, 22-24

Verification successful

Verified imports for image processing and job handling.

The imports of sharp for image processing and IJobsService for job handling are correctly utilized within the public-datas.service.ts file.

  • sharp is used for handling image metadata.
  • IJobsService is injected and used for job handling.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of sharp and IJobsService in the service.

# Test: Search for the usage of sharp and IJobsService.
rg --type python -A 5 $'sharp|IJobsService'

Length of output: 75


Script:

#!/bin/bash
# Description: Verify the usage of sharp and IJobsService in the service.

# Test: Search for the usage of sharp and IJobsService within TypeScript files.
rg --type ts -A 5 'sharp|IJobsService'

Length of output: 19333


Line range hint 417-456: Thumbnail generation logic for image uploads.

The logic for generating thumbnails during the file upload process has been implemented. This includes extracting image dimensions using sharp and adding these dimensions to the metadata. Ensure that the error handling and performance implications of this logic are considered.

Also applies to: 491-534

Verification successful

Verification successful for error handling and performance considerations in thumbnail generation logic.

The code includes appropriate catch blocks to handle errors during image processing and uses await for asynchronous operations to manage performance implications effectively.

  • Error Handling: Errors are caught and either logged or ignored, which is suitable for the context.
  • Performance: Asynchronous operations with await ensure non-blocking execution.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the error handling and performance of thumbnail generation logic.

# Test: Search for error handling related to thumbnail generation.
rg --type python -A 5 $'catch'

Length of output: 60


Script:

#!/bin/bash
# Description: Verify the error handling and performance of thumbnail generation logic.

# Test: Search for error handling related to thumbnail generation in the TypeScript file.
rg --type ts -A 5 'catch' packages/nocodb/src/services/public-datas.service.ts

# Test: Search for performance-related code (e.g., await) in the TypeScript file.
rg --type ts -A 5 'await' packages/nocodb/src/services/public-datas.service.ts

Length of output: 12855


33-36: Constructor added for JobsService injection.

The constructor for JobsService injection is necessary for handling thumbnail generation jobs. Ensure that the JobsService is correctly configured and used within the service.

Verification successful

JobsService is correctly configured and used.

The JobsService is consistently imported, injected, and utilized across multiple files in the codebase. This confirms that the constructor addition for JobsService injection is appropriate and necessary.

  • packages/nocodb/src/services/hook-handler.service.ts
  • packages/nocodb/src/services/public-datas.service.ts
  • packages/nocodb/src/modules/jobs/jobs.controller.ts
  • packages/nocodb/src/modules/jobs/jobs/source-delete/source-delete.controller.ts
  • packages/nocodb/src/modules/jobs/jobs/source-create/source-create.controller.ts
  • packages/nocodb/src/modules/jobs/jobs/at-import/at-import.controller.ts
  • packages/nocodb/src/modules/jobs/jobs.module.ts
  • packages/nocodb/src/modules/jobs/jobs/meta-sync/meta-sync.controller.ts
  • packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/attachments.service.ts
  • packages/nocodb/src/modules/jobs/jobs/export-import/duplicate.controller.ts
  • packages/nocodb/src/modules/jobs/jobs/data-export/data-export.controller.ts
  • packages/nocodb/src/modules/jobs/redis/jobs.service.ts
  • packages/nocodb/src/modules/jobs/fallback/jobs.service.ts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the configuration and usage of JobsService.

# Test: Search for the configuration and usage of JobsService.
rg --type python -A 5 $'JobsService'

Length of output: 66


Script:

#!/bin/bash
# Description: Verify the configuration and usage of JobsService.

# Test: Search for the configuration and usage of JobsService in TypeScript files.
rg --type typescript -A 5 'JobsService'

Length of output: 74


Script:

#!/bin/bash
# Description: Verify the configuration and usage of JobsService.

# Test: Search for the configuration and usage of JobsService in TypeScript files.
rg --type ts -A 5 'JobsService'

Length of output: 16780

packages/nc-gui/components/smartsheet/calendar/SideMenu.vue (1)

589-589: Enhanced getPossibleAttachmentSrc function to handle 'tiny' thumbnails.

The addition of the 'tiny' argument allows for handling different thumbnail sizes, aligning with the new thumbnail generation feature. Ensure that this change is reflected across all relevant parts of the application where thumbnails are used.

Verification successful

Enhanced getPossibleAttachmentSrc function to handle 'tiny' thumbnails.

The addition of the 'tiny' argument allows for handling different thumbnail sizes, aligning with the new thumbnail generation feature. This change is reflected across various parts of the application where thumbnails are used.

  • packages/nc-gui/components/smartsheet/calendar/SideMenu.vue
  • packages/nc-gui/components/virtual-cell/components/ListItem.vue
  • packages/nc-gui/composables/useAttachment.ts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of 'tiny' argument across the application.

# Test: Search for the usage of 'tiny' argument.
rg --type python -A 5 $'tiny'

Length of output: 59


Script:

#!/bin/bash
# Description: Verify the usage of 'tiny' argument across the application.

# Test: Search for the usage of 'tiny' argument in Vue and JavaScript files.
rg --type vue --type js -A 5 'tiny'

Length of output: 63


Script:

#!/bin/bash
# Description: Verify the usage of 'tiny' argument across the application.

# Test: Search for the usage of 'tiny' argument in all files.
rg -A 5 'tiny'

Length of output: 160105

packages/nc-gui/components/smartsheet/Kanban.vue (1)

793-793: Check integration of thumbnail generator feature

The change to include an additional argument 'card_cover' in the getPossibleAttachmentSrc function call is directly related to the new thumbnail generator feature. This is a key part of the PR's objectives.

Ensure that this change does not unintentionally affect other areas where getPossibleAttachmentSrc is used. It would be beneficial to verify that all usages of this function have been appropriately updated or guarded against potential side effects.

Verification successful

Check integration of thumbnail generator feature

The change to include an additional argument 'card_cover' in the getPossibleAttachmentSrc function call is correctly integrated. The function is used across multiple files, and the instances where it is called with the thumbnail argument ('card_cover', 'tiny', 'small') are appropriately handled.

  • packages/nc-gui/components/smartsheet/Kanban.vue
  • packages/nc-gui/components/virtual-cell/components/ListItem.vue
  • packages/nc-gui/components/smartsheet/Gallery.vue
  • packages/nc-gui/components/smartsheet/calendar/SideMenu.vue
  • packages/nc-gui/components/cell/attachment/Modal.vue
  • packages/nc-gui/components/cell/attachment/index.vue

The integration aligns with the PR's objectives and does not introduce unintended side effects.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `getPossibleAttachmentSrc` to ensure they handle the new argument correctly.

# Test: Search for the function usage. Expect: Only occurances of the new signature.
rg --type vue -A 5 $'getPossibleAttachmentSrc'

Length of output: 73


Script:

#!/bin/bash
# Description: Verify all function calls to `getPossibleAttachmentSrc` to ensure they handle the new argument correctly.

# Test: Search for the function usage in all files.
rg -A 5 $'getPossibleAttachmentSrc'

Length of output: 11526

@o1lab o1lab force-pushed the nc-thumbnail-processor branch from 522cd39 to d66af97 Compare July 16, 2024 13:17
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

Outside diff range, codebase verification and nitpick comments (1)
packages/nocodb/src/services/attachments.service.ts (1)

Line range hint 60-154: Assess the logic and security implications of image metadata extraction and thumbnail generation.

The method upload now handles image metadata extraction and thumbnail generation. Ensure that the image processing logic is secure and does not introduce any vulnerabilities. Additionally, the use of asynchronous job creation for thumbnail generation should be verified to ensure it does not impact system performance or stability.

- const metadata = await sharp(file.path, {
+ const metadata = await sharp(file.path).metadata();
- }).metadata();
+ // Ensure that error handling is robust to handle potential image processing failures
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 522cd39 and d66af97.

Files selected for processing (30)
  • packages/nc-gui/components/cell/attachment/Image.vue (1 hunks)
  • packages/nc-gui/components/cell/attachment/Modal.vue (1 hunks)
  • packages/nc-gui/components/cell/attachment/index.vue (2 hunks)
  • packages/nc-gui/components/smartsheet/Gallery.vue (1 hunks)
  • packages/nc-gui/components/smartsheet/Kanban.vue (1 hunks)
  • packages/nc-gui/components/smartsheet/calendar/SideMenu.vue (1 hunks)
  • packages/nc-gui/components/virtual-cell/components/ListItem.vue (1 hunks)
  • packages/nc-gui/composables/useAttachment.ts (1 hunks)
  • packages/nocodb/.gitignore (1 hunks)
  • packages/nocodb/src/controllers/attachments-secure.controller.ts (2 hunks)
  • packages/nocodb/src/controllers/attachments.controller.ts (4 hunks)
  • packages/nocodb/src/db/BaseModelSqlv2.ts (3 hunks)
  • packages/nocodb/src/interface/Jobs.ts (3 hunks)
  • packages/nocodb/src/modules/jobs/fallback/fallback-queue.service.ts (3 hunks)
  • packages/nocodb/src/modules/jobs/jobs.module.ts (2 hunks)
  • packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/thumbnail-generator.processor.ts (1 hunks)
  • packages/nocodb/src/modules/noco.module.ts (10 hunks)
  • packages/nocodb/src/plugins/backblaze/Backblaze.ts (2 hunks)
  • packages/nocodb/src/plugins/gcs/Gcs.ts (2 hunks)
  • packages/nocodb/src/plugins/linode/LinodeObjectStorage.ts (2 hunks)
  • packages/nocodb/src/plugins/mino/Minio.ts (2 hunks)
  • packages/nocodb/src/plugins/ovhCloud/OvhCloud.ts (2 hunks)
  • packages/nocodb/src/plugins/s3/S3.ts (1 hunks)
  • packages/nocodb/src/plugins/scaleway/ScalewayObjectStorage.ts (2 hunks)
  • packages/nocodb/src/plugins/spaces/Spaces.ts (2 hunks)
  • packages/nocodb/src/plugins/storage/Local.ts (2 hunks)
  • packages/nocodb/src/plugins/upcloud/UpoCloud.ts (2 hunks)
  • packages/nocodb/src/plugins/vultr/Vultr.ts (2 hunks)
  • packages/nocodb/src/services/attachments.service.ts (9 hunks)
  • packages/nocodb/src/services/public-datas.service.ts (7 hunks)
Files skipped from review as they are similar to previous changes (27)
  • packages/nc-gui/components/cell/attachment/Image.vue
  • packages/nc-gui/components/cell/attachment/Modal.vue
  • packages/nc-gui/components/cell/attachment/index.vue
  • packages/nc-gui/components/smartsheet/Gallery.vue
  • packages/nc-gui/components/smartsheet/Kanban.vue
  • packages/nc-gui/components/smartsheet/calendar/SideMenu.vue
  • packages/nc-gui/components/virtual-cell/components/ListItem.vue
  • packages/nc-gui/composables/useAttachment.ts
  • packages/nocodb/.gitignore
  • packages/nocodb/src/db/BaseModelSqlv2.ts
  • packages/nocodb/src/interface/Jobs.ts
  • packages/nocodb/src/modules/jobs/fallback/fallback-queue.service.ts
  • packages/nocodb/src/modules/jobs/jobs.module.ts
  • packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/thumbnail-generator.processor.ts
  • packages/nocodb/src/modules/noco.module.ts
  • packages/nocodb/src/plugins/backblaze/Backblaze.ts
  • packages/nocodb/src/plugins/gcs/Gcs.ts
  • packages/nocodb/src/plugins/linode/LinodeObjectStorage.ts
  • packages/nocodb/src/plugins/mino/Minio.ts
  • packages/nocodb/src/plugins/ovhCloud/OvhCloud.ts
  • packages/nocodb/src/plugins/s3/S3.ts
  • packages/nocodb/src/plugins/scaleway/ScalewayObjectStorage.ts
  • packages/nocodb/src/plugins/spaces/Spaces.ts
  • packages/nocodb/src/plugins/storage/Local.ts
  • packages/nocodb/src/plugins/upcloud/UpoCloud.ts
  • packages/nocodb/src/plugins/vultr/Vultr.ts
  • packages/nocodb/src/services/public-datas.service.ts
Additional comments not posted (1)
packages/nocodb/src/services/attachments.service.ts (1)

9-9: Verify the use of sharp for image processing.

The use of sharp for image processing is generally safe and efficient. However, ensure that the image data handled by sharp is sanitized and validated to prevent potential security vulnerabilities such as image payload attacks.

@o1lab o1lab force-pushed the nc-thumbnail-processor branch from d66af97 to e009297 Compare July 16, 2024 13:41
@o1lab o1lab force-pushed the nc-thumbnail-processor branch from 33e5ce8 to a50de3f Compare July 22, 2024 12:09
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 10

Outside diff range, codebase verification and nitpick comments (4)
packages/nocodb/src/plugins/gcs/Gcs.ts (2)

Line range hint 121-129:
Improve error handling in the fileCreateByUrl method.

Include more context in the error message to provide better insights during debugging.

-  .catch((error) => {
-    reject(error);
-  });
+  .catch((error) => {
+    reject(new Error(`Failed to upload file from URL: ${url}. Error: ${error.message}`));
+  });

Line range hint 90-100:
Improve error handling in the fileRead method.

Include more context in the error message to provide better insights during debugging.

-  file.exists((err, exists) => {
-    if (exists) {
-      file.download((downerr, data) => {
-        if (err) {
-          return reject(downerr);
-        }
-        return resolve(data);
-      });
-    } else {
-      reject(err);
-    }
-  });
+  file.exists((err, exists) => {
+    if (err) {
+      return reject(new Error(`Failed to check existence of file: ${key}. Error: ${err.message}`));
+    }
+    if (exists) {
+      file.download((downerr, data) => {
+        if (downerr) {
+          return reject(new Error(`Failed to download file: ${key}. Error: ${downerr.message}`));
+        }
+        return resolve(data);
+      });
+    } else {
+      reject(new Error(`File does not exist: ${key}`));
+    }
+  });
packages/nocodb/src/plugins/s3/S3.ts (2)

Line range hint 63-83:
Improve error handling in the fileCreateByStream method.

Include more context in the error message to provide better insights during debugging.

-  .catch((err) => {
-    reject(err);
-  });
+  .catch((err) => {
+    reject(new Error(`Failed to upload file to path: ${key}. Error: ${err.message}`));
+  });
Tools
Biome

[error] 59-59: The catch clause that only rethrows the original error is redundant.

These unnecessary catch clauses can be confusing. It is recommended to remove them.

(lint/complexity/noUselessCatch)


Line range hint 113-123:
Improve error handling in the fileRead method.

Include more context in the error message to provide better insights during debugging.

-  this.s3Client.getObject({ Key: key } as any, (err, data) => {
-    if (err) {
-      return reject(err);
-    }
-    if (!data?.Body) {
-      return reject(data);
-    }
-    return resolve(data.Body);
-  });
+  this.s3Client.getObject({ Key: key } as any, (err, data) => {
+    if (err) {
+      return reject(new Error(`Failed to read file: ${key}. Error: ${err.message}`));
+    }
+    if (!data?.Body) {
+      return reject(new Error(`File has no body: ${key}`));
+    }
+    return resolve(data.Body);
+  });
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e009297 and a50de3f.

Files selected for processing (30)
  • packages/nc-gui/components/cell/attachment/Image.vue (1 hunks)
  • packages/nc-gui/components/cell/attachment/Modal.vue (1 hunks)
  • packages/nc-gui/components/cell/attachment/index.vue (2 hunks)
  • packages/nc-gui/components/smartsheet/Gallery.vue (1 hunks)
  • packages/nc-gui/components/smartsheet/Kanban.vue (1 hunks)
  • packages/nc-gui/components/smartsheet/calendar/SideMenu.vue (1 hunks)
  • packages/nc-gui/components/virtual-cell/components/ListItem.vue (1 hunks)
  • packages/nc-gui/composables/useAttachment.ts (1 hunks)
  • packages/nocodb/.gitignore (1 hunks)
  • packages/nocodb/src/controllers/attachments-secure.controller.ts (2 hunks)
  • packages/nocodb/src/controllers/attachments.controller.ts (4 hunks)
  • packages/nocodb/src/db/BaseModelSqlv2.ts (2 hunks)
  • packages/nocodb/src/interface/Jobs.ts (3 hunks)
  • packages/nocodb/src/modules/jobs/fallback/fallback-queue.service.ts (3 hunks)
  • packages/nocodb/src/modules/jobs/jobs.module.ts (2 hunks)
  • packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/thumbnail-generator.processor.ts (1 hunks)
  • packages/nocodb/src/modules/noco.module.ts (2 hunks)
  • packages/nocodb/src/plugins/backblaze/Backblaze.ts (3 hunks)
  • packages/nocodb/src/plugins/gcs/Gcs.ts (3 hunks)
  • packages/nocodb/src/plugins/linode/LinodeObjectStorage.ts (3 hunks)
  • packages/nocodb/src/plugins/mino/Minio.ts (3 hunks)
  • packages/nocodb/src/plugins/ovhCloud/OvhCloud.ts (3 hunks)
  • packages/nocodb/src/plugins/s3/S3.ts (3 hunks)
  • packages/nocodb/src/plugins/scaleway/ScalewayObjectStorage.ts (3 hunks)
  • packages/nocodb/src/plugins/spaces/Spaces.ts (3 hunks)
  • packages/nocodb/src/plugins/storage/Local.ts (2 hunks)
  • packages/nocodb/src/plugins/upcloud/UpoCloud.ts (3 hunks)
  • packages/nocodb/src/plugins/vultr/Vultr.ts (3 hunks)
  • packages/nocodb/src/services/attachments.service.ts (9 hunks)
  • packages/nocodb/src/services/public-datas.service.ts (7 hunks)
Files skipped from review due to trivial changes (1)
  • packages/nc-gui/components/virtual-cell/components/ListItem.vue
Files skipped from review as they are similar to previous changes (18)
  • packages/nc-gui/components/cell/attachment/Image.vue
  • packages/nc-gui/components/cell/attachment/Modal.vue
  • packages/nc-gui/components/cell/attachment/index.vue
  • packages/nc-gui/components/smartsheet/Gallery.vue
  • packages/nc-gui/components/smartsheet/Kanban.vue
  • packages/nc-gui/components/smartsheet/calendar/SideMenu.vue
  • packages/nocodb/.gitignore
  • packages/nocodb/src/controllers/attachments-secure.controller.ts
  • packages/nocodb/src/controllers/attachments.controller.ts
  • packages/nocodb/src/interface/Jobs.ts
  • packages/nocodb/src/modules/jobs/fallback/fallback-queue.service.ts
  • packages/nocodb/src/modules/jobs/jobs.module.ts
  • packages/nocodb/src/modules/noco.module.ts
  • packages/nocodb/src/plugins/scaleway/ScalewayObjectStorage.ts
  • packages/nocodb/src/plugins/spaces/Spaces.ts
  • packages/nocodb/src/plugins/storage/Local.ts
  • packages/nocodb/src/plugins/upcloud/UpoCloud.ts
  • packages/nocodb/src/services/attachments.service.ts
Additional context used
Biome
packages/nocodb/src/plugins/s3/S3.ts

[error] 59-59: The catch clause that only rethrows the original error is redundant.

These unnecessary catch clauses can be confusing. It is recommended to remove them.

(lint/complexity/noUselessCatch)

Additional comments not posted (19)
packages/nc-gui/composables/useAttachment.ts (2)

4-9: LGTM! Ensure the new parameter is handled correctly.

The changes to handle the thumbnail parameter are correct. Ensure that the new parameter is used correctly in all function calls.


4-9: Verify the correctness of the recursive call.

The recursive call to getPossibleAttachmentSrc should correctly handle the thumbnail parameter to avoid infinite recursion or incorrect results.

Verification successful

The recursive call in getPossibleAttachmentSrc is correctly implemented.

The function correctly handles the thumbnail parameter and prevents infinite recursion by not passing the thumbnail parameter in the recursive call.

  • The recursive call getPossibleAttachmentSrc(item.thumbnails[thumbnail])[0] is correctly implemented.
  • The function usage without the thumbnail parameter is consistent with the intended functionality.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of the recursive call in `getPossibleAttachmentSrc`.

# Test: Search for the function usage to ensure it handles the `thumbnail` parameter correctly.
rg --type typescript -A 5 $'getPossibleAttachmentSrc'

Length of output: 87


Script:

#!/bin/bash
# Description: Verify the correctness of the recursive call in `getPossibleAttachmentSrc`.

# Test: Search for the function usage to ensure it handles the `thumbnail` parameter correctly.
rg --glob '*.ts' -A 5 'getPossibleAttachmentSrc'

Length of output: 1907

packages/nocodb/src/plugins/vultr/Vultr.ts (1)

19-22: LGTM! Verify the function usage.

The changes streamline the file creation process by delegating the upload logic to the fileCreateByStream method.

Ensure that the function calls to fileCreate handle the changes correctly.

Verification successful

LGTM! Verify the function usage.

The changes streamline the file creation process by delegating the upload logic to the fileCreateByStream method. The function calls to fileCreate handle the changes correctly.

  • Instances of fileCreate in multiple files show consistent usage with the new implementation.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the function calls to `fileCreate` handle the changes correctly.

# Test: Search for the function usage to ensure it handles the changes correctly.
rg --type typescript -A 5 $'fileCreate'

Length of output: 73


Script:

#!/bin/bash
# Description: Verify the function calls to `fileCreate` handle the changes correctly.

# Test: Search for the function usage to ensure it handles the changes correctly.
rg --type ts -A 5 $'fileCreate'

Length of output: 28646

packages/nocodb/src/plugins/linode/LinodeObjectStorage.ts (1)

19-22: LGTM! Verify the function usage.

The changes improve code clarity by separating concerns and enhancing the file creation process.

Ensure that the function calls to fileCreate handle the changes correctly.

Verification successful

Let's re-run the verification by first finding all TypeScript files and then searching for fileCreate within those files.


LGTM! Verify the function usage.

The changes improve code clarity by separating concerns and enhancing the file creation process. The function calls to fileCreate appear to handle the changes correctly based on the search results.

  • Ensure that the function calls to fileCreate handle the changes correctly in the following files:
    • packages/nocodb/src/plugins/linode/LinodeObjectStorage.ts
    • Other files where fileCreate is used.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the function calls to `fileCreate` handle the changes correctly.

# Test: Search for the function usage to ensure it handles the changes correctly.
rg --type typescript -A 5 $'fileCreate'

Length of output: 73


Script:

#!/bin/bash
# Description: Verify the function calls to `fileCreate` handle the changes correctly.

# Find all TypeScript files and search for the function usage to ensure it handles the changes correctly.
fd -e ts -e tsx -x rg 'fileCreate' {}

Length of output: 3584

packages/nocodb/src/plugins/ovhCloud/OvhCloud.ts (1)

19-22: LGTM! The changes improve separation of concerns.

The fileCreate method now correctly delegates stream handling to fileCreateByStream.

packages/nocodb/src/plugins/backblaze/Backblaze.ts (1)

19-22: LGTM! The changes improve separation of concerns.

The fileCreate method now correctly delegates stream handling to fileCreateByStream.

packages/nocodb/src/plugins/mino/Minio.ts (1)

19-21: LGTM! The changes improve separation of concerns.

The fileCreate method now correctly delegates stream handling to fileCreateByStream.

packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/thumbnail-generator.processor.ts (1)

18-22: LGTM!

The constructor and logger initialization are straightforward and correct.

packages/nocodb/src/plugins/gcs/Gcs.ts (1)

Line range hint 24-32:
LGTM!

The fileCreate method is well-structured and follows best practices for uploading files to Google Cloud Storage.

packages/nocodb/src/plugins/s3/S3.ts (2)

31-34: LGTM!

The fileCreate method is well-structured and follows best practices for uploading files to AWS S3.


Line range hint 164-181:
LGTM!

The upload method is well-structured and follows best practices for uploading files to AWS S3.

packages/nocodb/src/services/public-datas.service.ts (5)

2-2: LGTM! New imports are appropriate.

The new imports are necessary for the added functionality, including dependency injection and image processing.

Also applies to: 8-8, 22-24


33-36: LGTM! Constructor for injecting JobsService is well-implemented.

The constructor uses forwardRef to avoid circular dependencies and correctly injects JobsService.


417-432: Extracting image metadata is well-implemented.

The code correctly extracts image metadata (width and height) using sharp for files with image MIME types.


491-513: Extracting image metadata from URL is well-implemented.

The code correctly extracts image metadata (width and height) using sharp for images uploaded by URL.


542-548: Adding thumbnail generation job is well-implemented.

The code correctly adds a job to generate thumbnails using JobsService.

packages/nocodb/src/db/BaseModelSqlv2.ts (3)

7209-7213: Optimize thumbnail path handling in lookedUpAttachment

The code for handling thumbnail paths in the lookedUpAttachment object can be optimized. Currently, the relative path is recalculated multiple times which is inefficient.

- let relativePath = lookedUpAttachment.path.replace(/^download\//, '');
+ let basePath = lookedUpAttachment.path.replace(/^download\//, '');
+ let relativePath = `thumbnails/${basePath}`;

7308-7309: Optimize thumbnail path handling for single attachments

The code for handling thumbnail paths for single attachments can be optimized to avoid redundant string operations.

- let relativePath = attachment.path.replace(/^download\//, '');
+ let basePath = attachment.path.replace(/^download\//, '');
+ let relativePath = `thumbnails/${basePath}`;

8520-8521: Ensure width and height properties are handled properly

The code now includes handling for width and height properties for attachments. Ensure that these properties are correctly populated and validated.

Verification successful

Ensure width and height properties are handled properly

The width and height properties for attachments are being properly handled and validated in the codebase. Key locations include:

  • packages/nocodb/src/services/attachments.service.ts
  • packages/nocodb/src/services/public-datas.service.ts
  • packages/nocodb/src/db/BaseModelSqlv2.ts

These files contain logic to populate and validate these properties, ensuring they are correctly managed.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that width and height properties are handled properly in attachments.

# Test: Search for the usage of width and height properties in the codebase. Expect: Proper handling and validation.
rg --type typescript -A 5 $'width|height'

Length of output: 77


Script:

#!/bin/bash
# Description: Verify that width and height properties are handled properly in attachments.

# Test: Search for the usage of width and height properties in the codebase. Expect: Proper handling and validation.
rg --type ts -A 5 'width|height'

Length of output: 170848

@o1lab o1lab force-pushed the nc-thumbnail-processor branch from a50de3f to f05344a Compare July 24, 2024 06:52
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between a50de3f and f05344a.

Files selected for processing (30)
  • packages/nc-gui/components/cell/attachment/Image.vue (1 hunks)
  • packages/nc-gui/components/cell/attachment/Modal.vue (1 hunks)
  • packages/nc-gui/components/cell/attachment/index.vue (2 hunks)
  • packages/nc-gui/components/smartsheet/Gallery.vue (1 hunks)
  • packages/nc-gui/components/smartsheet/Kanban.vue (1 hunks)
  • packages/nc-gui/components/smartsheet/calendar/SideMenu.vue (1 hunks)
  • packages/nc-gui/components/virtual-cell/components/ListItem.vue (1 hunks)
  • packages/nc-gui/composables/useAttachment.ts (1 hunks)
  • packages/nocodb/.gitignore (1 hunks)
  • packages/nocodb/src/controllers/attachments-secure.controller.ts (2 hunks)
  • packages/nocodb/src/controllers/attachments.controller.ts (4 hunks)
  • packages/nocodb/src/db/BaseModelSqlv2.ts (2 hunks)
  • packages/nocodb/src/interface/Jobs.ts (3 hunks)
  • packages/nocodb/src/modules/jobs/fallback/fallback-queue.service.ts (3 hunks)
  • packages/nocodb/src/modules/jobs/jobs.module.ts (2 hunks)
  • packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/thumbnail-generator.processor.ts (1 hunks)
  • packages/nocodb/src/modules/noco.module.ts (2 hunks)
  • packages/nocodb/src/plugins/backblaze/Backblaze.ts (3 hunks)
  • packages/nocodb/src/plugins/gcs/Gcs.ts (3 hunks)
  • packages/nocodb/src/plugins/linode/LinodeObjectStorage.ts (3 hunks)
  • packages/nocodb/src/plugins/mino/Minio.ts (3 hunks)
  • packages/nocodb/src/plugins/ovhCloud/OvhCloud.ts (3 hunks)
  • packages/nocodb/src/plugins/s3/S3.ts (3 hunks)
  • packages/nocodb/src/plugins/scaleway/ScalewayObjectStorage.ts (3 hunks)
  • packages/nocodb/src/plugins/spaces/Spaces.ts (3 hunks)
  • packages/nocodb/src/plugins/storage/Local.ts (2 hunks)
  • packages/nocodb/src/plugins/upcloud/UpoCloud.ts (3 hunks)
  • packages/nocodb/src/plugins/vultr/Vultr.ts (3 hunks)
  • packages/nocodb/src/services/attachments.service.ts (9 hunks)
  • packages/nocodb/src/services/public-datas.service.ts (7 hunks)
Files skipped from review as they are similar to previous changes (19)
  • packages/nc-gui/components/cell/attachment/Modal.vue
  • packages/nc-gui/components/cell/attachment/index.vue
  • packages/nc-gui/components/smartsheet/Gallery.vue
  • packages/nc-gui/components/smartsheet/Kanban.vue
  • packages/nc-gui/components/smartsheet/calendar/SideMenu.vue
  • packages/nc-gui/components/virtual-cell/components/ListItem.vue
  • packages/nc-gui/composables/useAttachment.ts
  • packages/nocodb/.gitignore
  • packages/nocodb/src/controllers/attachments.controller.ts
  • packages/nocodb/src/db/BaseModelSqlv2.ts
  • packages/nocodb/src/interface/Jobs.ts
  • packages/nocodb/src/modules/jobs/fallback/fallback-queue.service.ts
  • packages/nocodb/src/modules/jobs/jobs.module.ts
  • packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/thumbnail-generator.processor.ts
  • packages/nocodb/src/modules/noco.module.ts
  • packages/nocodb/src/plugins/gcs/Gcs.ts
  • packages/nocodb/src/plugins/scaleway/ScalewayObjectStorage.ts
  • packages/nocodb/src/plugins/spaces/Spaces.ts
  • packages/nocodb/src/services/attachments.service.ts
Additional context used
Biome
packages/nocodb/src/plugins/s3/S3.ts

[error] 59-59: The catch clause that only rethrows the original error is redundant.

These unnecessary catch clauses can be confusing. It is recommended to remove them.

(lint/complexity/noUselessCatch)

Additional comments not posted (23)
packages/nc-gui/components/cell/attachment/Image.vue (3)

11-13: LGTM! The explicit increment operation improves clarity.

The change from index.value++ to index.value = index.value + 1 enhances readability.


17-19: Reminder: Fix the issue with <LazyNuxtImg>.

The TODO comment indicates that the issue with <LazyNuxtImg> needs to be fixed.


20-26: LGTM! The changes to the <img> element improve robustness.

Replacing <LazyNuxtImg> with <img> and adding @error="onError" enhances error handling. The use of props.srcs?.length ensures robustness against undefined properties.

packages/nocodb/src/controllers/attachments-secure.controller.ts (2)

2-2: Verify the use of fs.existsSync for potential blocking I/O operations.

The use of fs.existsSync might introduce blocking I/O operations in a Node.js environment, which is generally not recommended. Consider using asynchronous versions like fs.promises.exists or fs.access with a callback to avoid blocking the event loop.


86-87: Assess the logic and security implications of file path handling and existence check.

The logic for determining filePath based on the parameter might introduce security risks if not properly sanitized, leading to potential directory traversal attacks. Additionally, the use of fs.existsSync should be replaced with a non-blocking approach. Ensure that all user inputs are properly sanitized before use in file paths.

packages/nocodb/src/plugins/vultr/Vultr.ts (1)

63-87: Ensure proper error handling and return type consistency.

The fileCreateByStream method correctly handles asynchronous file uploads using promises. However, the return type in the method signature is Promise<void>, but the promise resolves with data.Location. Update the return type to Promise<any> for consistency.

packages/nocodb/src/plugins/upcloud/UpoCloud.ts (2)

19-22: LGTM! But verify the method usage in the codebase.

The code changes are approved.

However, ensure that all method calls to fileCreate match the new return structure.

Verification successful

Verification successful!

The method calls to fileCreate match the new return structure across the codebase.

  • Instances found in multiple files such as packages/nocodb/src/plugins/upcloud/UpoCloud.ts, packages/nocodb/src/plugins/scaleway/ScalewayObjectStorage.ts, and others confirm consistent usage.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all method calls to `fileCreate` match the new return structure.

# Test: Search for the method usage. Expect: Only occurances of the new return structure.
rg --type python -A 5 $'fileCreate'

Length of output: 65


Script:

#!/bin/bash
# Description: Verify all method calls to `fileCreate` match the new return structure.

# Test: Search for the method usage. Expect: Only occurrences of the new return structure.
rg --type ts -A 5 'fileCreate'

Length of output: 28646


63-87: Ensure proper error handling and return type consistency.

The fileCreateByStream method correctly handles asynchronous file uploads using promises. However, the return type in the method signature is Promise<void>, but the promise resolves with data.Location. Update the return type to Promise<any> for consistency.

-  async fileCreateByStream(key: string, stream: Readable, options?: { mimetype?: string; }): Promise<void> {
+  async fileCreateByStream(key: string, stream: Readable, options?: { mimetype?: string; }): Promise<any> {

Additionally, ensure that all method calls to fileCreateByStream match the new return structure.

packages/nocodb/src/plugins/linode/LinodeObjectStorage.ts (2)

19-22: LGTM! But verify the method usage in the codebase.

The code changes are approved.

However, ensure that all method calls to fileCreate match the new return structure.


63-87: Ensure proper error handling and return type consistency.

The fileCreateByStream method correctly handles asynchronous file uploads using promises. However, the return type in the method signature is Promise<void>, but the promise resolves with data.Location. Update the return type to Promise<any> for consistency.

-  async fileCreateByStream(key: string, stream: Readable, options?: { mimetype?: string }): Promise<void> {
+  async fileCreateByStream(key: string, stream: Readable, options?: { mimetype?: string }): Promise<any> {

Additionally, ensure that all method calls to fileCreateByStream match the new return structure.

packages/nocodb/src/plugins/ovhCloud/OvhCloud.ts (2)

19-22: LGTM! But verify the method usage in the codebase.

The code changes are approved.

However, ensure that all method calls to fileCreate match the new return structure.

Verification successful

All method calls to fileCreate match the new return structure.

The code changes are verified and consistent across the codebase.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all method calls to `fileCreate` match the new return structure.

# Test: Search for the method usage. Expect: Only occurances of the new return structure.
rg --type python -A 5 $'fileCreate'

Length of output: 65


Script:

#!/bin/bash
# Description: Verify all method calls to `fileCreate` match the new return structure.

# Test: Search for the method usage in TypeScript files. Expect: Only occurrences of the new return structure.
rg --type typescript -A 5 'fileCreate'

Length of output: 73


Script:

#!/bin/bash
# Description: Verify all method calls to `fileCreate` match the new return structure.

# Test: Search for the method usage in `.ts` files. Expect: Only occurrences of the new return structure.
rg --type ts -A 5 'fileCreate'

Length of output: 28646


63-92: Optimize the fileCreateByStream method and add error handling.

The method can be simplified by removing the unnecessary promise wrapper and using async/await for better readability and error handling.

-  async fileCreateByStream(key: string, stream: Readable, options?: { mimetype?: string; }): Promise<void> {
+  async fileCreateByStream(key: string, stream: Readable, options?: { mimetype?: string; }): Promise<any> {
    const uploadParams: any = {
      ACL: 'public-read',
      Body: stream,
      Key: key,
    };

    try {
      stream.on('error', (err) => {
        console.log('Stream Error', err);
        throw err;
      });

      const data = await this.s3Client.upload(uploadParams).promise();
      return data.Location;
    } catch (err) {
      console.log('Error', err);
      throw err;
    }
  }

Additionally, ensure that all method calls to fileCreateByStream match the new return structure.

packages/nocodb/src/plugins/backblaze/Backblaze.ts (1)

19-22: LGTM! Improved code readability and maintainability.

The changes in the fileCreate method improve code readability and maintainability by delegating the upload process to fileCreateByStream.

packages/nocodb/src/plugins/mino/Minio.ts (1)

19-21: LGTM! Improved code readability and maintainability.

The changes in the fileCreate method improve code readability and maintainability by delegating the upload process to fileCreateByStream.

packages/nocodb/src/plugins/s3/S3.ts (4)

32-34: LGTM!

The addition of the options parameter with the mimetype property to fileCreateByStream enhances flexibility by allowing dynamic MIME type specification.


54-57: LGTM! But improve error handling.

The updated return structure enhances the response by including both the URL and the data. However, improve error handling to provide better insights during debugging.

-  .catch((error) => {
-    throw error;
-  });
+  .catch((error) => {
+    throw new Error(`Failed to upload file from URL: ${url}. Error: ${error.message}`);
+  });

63-69: LGTM!

The addition of the options parameter with the mimetype property to fileCreateByStream enhances flexibility by allowing dynamic MIME type specification.


81-82: LGTM!

Setting the ContentType using the mimetype from the options parameter or defaulting to application/octet-stream ensures correct MIME type handling.

packages/nocodb/src/services/public-datas.service.ts (5)

Line range hint 2-24:
LGTM!

The new imports for sharp, IJobsService, JobTypes, and RootScopes are necessary for image processing and job handling.


33-36: LGTM!

The addition of the constructor to inject JobsService enables interaction with job-related functionalities, which is essential for the new thumbnail generation feature.


417-432: LGTM!

The logic for extracting image metadata (width and height) during file uploads is crucial for generating thumbnails and managing images effectively.


491-513: LGTM!

The logic for handling image uploads by URL and extracting metadata using sharp ensures consistency in managing images, whether uploaded directly or by URL.


541-548: LGTM!

The logic for adding thumbnail generation jobs using JobsService ensures that thumbnails are generated asynchronously, improving performance and user experience.

@o1lab o1lab force-pushed the nc-thumbnail-processor branch from f05344a to 918d74e Compare July 24, 2024 07:06
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

Outside diff range, codebase verification and nitpick comments (1)
packages/nocodb/src/plugins/s3/S3.ts (1)

Line range hint 63-88:
Ensure proper error handling and return type consistency.

The fileCreateByStream method correctly handles asynchronous file uploads using promises. However, the return type in the method signature is Promise<void>, but the promise resolves with data.Location. Update the return type to Promise<any> for consistency.

-  async fileCreateByStream(key: string, stream: Readable, options?: { mimetype?: string }): Promise<void> {
+  async fileCreateByStream(key: string, stream: Readable, options?: { mimetype?: string }): Promise<any> {
Tools
Biome

[error] 59-59: The catch clause that only rethrows the original error is redundant.

These unnecessary catch clauses can be confusing. It is recommended to remove them.

(lint/complexity/noUselessCatch)

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between f05344a and 918d74e.

Files selected for processing (30)
  • packages/nc-gui/components/cell/attachment/Image.vue (1 hunks)
  • packages/nc-gui/components/cell/attachment/Modal.vue (1 hunks)
  • packages/nc-gui/components/cell/attachment/index.vue (2 hunks)
  • packages/nc-gui/components/smartsheet/Gallery.vue (1 hunks)
  • packages/nc-gui/components/smartsheet/Kanban.vue (1 hunks)
  • packages/nc-gui/components/smartsheet/calendar/SideMenu.vue (1 hunks)
  • packages/nc-gui/components/virtual-cell/components/ListItem.vue (1 hunks)
  • packages/nc-gui/composables/useAttachment.ts (1 hunks)
  • packages/nocodb/.gitignore (1 hunks)
  • packages/nocodb/src/controllers/attachments-secure.controller.ts (2 hunks)
  • packages/nocodb/src/controllers/attachments.controller.ts (4 hunks)
  • packages/nocodb/src/db/BaseModelSqlv2.ts (2 hunks)
  • packages/nocodb/src/interface/Jobs.ts (3 hunks)
  • packages/nocodb/src/modules/jobs/fallback/fallback-queue.service.ts (3 hunks)
  • packages/nocodb/src/modules/jobs/jobs.module.ts (2 hunks)
  • packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/thumbnail-generator.processor.ts (1 hunks)
  • packages/nocodb/src/modules/noco.module.ts (2 hunks)
  • packages/nocodb/src/plugins/backblaze/Backblaze.ts (3 hunks)
  • packages/nocodb/src/plugins/gcs/Gcs.ts (3 hunks)
  • packages/nocodb/src/plugins/linode/LinodeObjectStorage.ts (3 hunks)
  • packages/nocodb/src/plugins/mino/Minio.ts (3 hunks)
  • packages/nocodb/src/plugins/ovhCloud/OvhCloud.ts (3 hunks)
  • packages/nocodb/src/plugins/s3/S3.ts (3 hunks)
  • packages/nocodb/src/plugins/scaleway/ScalewayObjectStorage.ts (3 hunks)
  • packages/nocodb/src/plugins/spaces/Spaces.ts (3 hunks)
  • packages/nocodb/src/plugins/storage/Local.ts (2 hunks)
  • packages/nocodb/src/plugins/upcloud/UpoCloud.ts (3 hunks)
  • packages/nocodb/src/plugins/vultr/Vultr.ts (3 hunks)
  • packages/nocodb/src/services/attachments.service.ts (9 hunks)
  • packages/nocodb/src/services/public-datas.service.ts (7 hunks)
Files skipped from review as they are similar to previous changes (23)
  • packages/nc-gui/components/cell/attachment/Modal.vue
  • packages/nc-gui/components/cell/attachment/index.vue
  • packages/nc-gui/components/smartsheet/Gallery.vue
  • packages/nc-gui/components/smartsheet/Kanban.vue
  • packages/nc-gui/components/smartsheet/calendar/SideMenu.vue
  • packages/nc-gui/components/virtual-cell/components/ListItem.vue
  • packages/nc-gui/composables/useAttachment.ts
  • packages/nocodb/.gitignore
  • packages/nocodb/src/controllers/attachments-secure.controller.ts
  • packages/nocodb/src/controllers/attachments.controller.ts
  • packages/nocodb/src/db/BaseModelSqlv2.ts
  • packages/nocodb/src/interface/Jobs.ts
  • packages/nocodb/src/modules/jobs/fallback/fallback-queue.service.ts
  • packages/nocodb/src/modules/jobs/jobs.module.ts
  • packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/thumbnail-generator.processor.ts
  • packages/nocodb/src/modules/noco.module.ts
  • packages/nocodb/src/plugins/gcs/Gcs.ts
  • packages/nocodb/src/plugins/mino/Minio.ts
  • packages/nocodb/src/plugins/ovhCloud/OvhCloud.ts
  • packages/nocodb/src/plugins/scaleway/ScalewayObjectStorage.ts
  • packages/nocodb/src/plugins/spaces/Spaces.ts
  • packages/nocodb/src/plugins/storage/Local.ts
  • packages/nocodb/src/services/attachments.service.ts
Additional context used
Biome
packages/nocodb/src/plugins/s3/S3.ts

[error] 59-59: The catch clause that only rethrows the original error is redundant.

These unnecessary catch clauses can be confusing. It is recommended to remove them.

(lint/complexity/noUselessCatch)

Additional comments not posted (15)
packages/nc-gui/components/cell/attachment/Image.vue (2)

11-13: LGTM! Explicit increment operation improves clarity.

The change from index.value++ to index.value = index.value + 1 enhances readability.


17-26: LGTM! Improved error handling and robustness.

The replacement of <LazyNuxtImg> with <img> and the added conditional check for props.srcs?.length enhance error handling. The binding of :placeholder to props.alt maintains functionality.

Reminder: Fix the issue with <LazyNuxtImg>.

The TODO comment indicates that the issue with <LazyNuxtImg> needs to be fixed.

packages/nocodb/src/plugins/vultr/Vultr.ts (2)

19-22: LGTM! Improved modularity and reusability.

The fileCreate method now delegates the upload logic to fileCreateByStream, enhancing modularity and reusability.


63-87: Ensure proper error handling and return type consistency.

The fileCreateByStream method correctly handles asynchronous file uploads using promises. However, the return type in the method signature is Promise<void>, but the promise resolves with data.Location. Update the return type to Promise<any> for consistency.

-  async fileCreateByStream(key: string, stream: Readable, options?: { mimetype: string }): Promise<void> {
+  async fileCreateByStream(key: string, stream: Readable, options?: { mimetype: string }): Promise<any> {
packages/nocodb/src/plugins/upcloud/UpoCloud.ts (2)

19-22: LGTM! Improved modularity and reusability.

The fileCreate method now delegates the upload logic to fileCreateByStream, enhancing modularity and reusability.


63-87: Ensure proper error handling and return type consistency.

The fileCreateByStream method correctly handles asynchronous file uploads using promises. However, the return type in the method signature is Promise<void>, but the promise resolves with data.Location. Update the return type to Promise<any> for consistency.

-  async fileCreateByStream(key: string, stream: Readable, options?: { mimetype?: string; }): Promise<void> {
+  async fileCreateByStream(key: string, stream: Readable, options?: { mimetype?: string; }): Promise<any> {
packages/nocodb/src/plugins/linode/LinodeObjectStorage.ts (2)

63-87: Ensure proper error handling and return type consistency.

The fileCreateByStream method correctly handles asynchronous file uploads using promises. However, the return type in the method signature is Promise<void>, but the promise resolves with data.Location. Update the return type to Promise<any> for consistency.

-  async fileCreateByStream(key: string, stream: Readable, options?: { mimetype?: string }): Promise<void> {
+  async fileCreateByStream(key: string, stream: Readable, options?: { mimetype?: string }): Promise<any> {

Likely invalid or redundant comment.


19-22: LGTM! But verify the function usage in the codebase.

The code changes are approved.

However, ensure that all function calls to fileCreate match the new signature.

Verification successful

Verified: The function fileCreate is consistently used with the new signature across the codebase.

  • The function is defined and used in various files, including different plugins and services.
  • All instances align with the expected behavior and signature.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `fileCreate` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type python -A 5 $'fileCreate'

Length of output: 65


Script:

#!/bin/bash
# Description: Verify all function calls to `fileCreate` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type js -A 5 $'fileCreate'

Length of output: 30


Script:

#!/bin/bash
# Description: Verify the definition and all function calls to `fileCreate` match the new signature.

# Test: Search for the function definition and usage. Expect: Occurrences of the new signature.
rg 'fileCreate' -t js -A 5

Length of output: 26


Script:

#!/bin/bash
# Description: Verify the definition and all function calls to `fileCreate` match the new signature.

# Test: Search for the function definition and usage. Expect: Occurrences of the new signature.
rg 'fileCreate' -A 5

Length of output: 28636

packages/nocodb/src/plugins/backblaze/Backblaze.ts (1)

19-22: LGTM! But verify the function usage in the codebase.

The code changes are approved.

However, ensure that all function calls to fileCreate match the new signature.

Verification successful

All function calls to fileCreate match the new signature.

The code changes are approved.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `fileCreate` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type python -A 5 $'fileCreate'

Length of output: 65


Script:

#!/bin/bash
# Description: Verify all function calls to `fileCreate` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type typescript -A 5 'fileCreate'

Length of output: 73


Script:

#!/bin/bash
# Description: Verify all function calls to `fileCreate` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type ts -A 5 'fileCreate'

Length of output: 28646

packages/nocodb/src/plugins/s3/S3.ts (1)

32-34: LGTM! But verify the function usage in the codebase.

The code changes are approved.

However, ensure that all function calls to fileCreate match the new signature.

packages/nocodb/src/services/public-datas.service.ts (5)

2-2: Ensure forwardRef, Inject, and Injectable are necessary.

Verify the necessity of these imports for dependency injection.


22-24: Ensure IJobsService, JobTypes, and RootScopes are necessary.

Verify the necessity of these imports for the new functionality.


33-36: Ensure JobsService is correctly injected.

Verify that JobsService is correctly injected and used in the class.

Verification successful

Verified JobsService injection and usage.

The JobsService is correctly injected and utilized within the public-datas.service.ts file.

  • jobsService is used in the method call this.jobsService.add(JobTypes.ThumbnailGenerator, { ... }).
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that `JobsService` is correctly injected and used in the class.

# Test: Search for `jobsService` usage in the class. Expect: `jobsService` should be used in the class.
rg --type ts 'jobsService' packages/nocodb/src/services/public-datas.service.ts

Length of output: 193


8-8: Ensure sharp is a dependency.

Verify that sharp is listed as a dependency in package.json.


542-548: Ensure JobTypes.ThumbnailGenerator is correctly used.

Verify that JobTypes.ThumbnailGenerator is correctly used and the job is added to the JobsService.

Verification successful

JobTypes.ThumbnailGenerator is correctly used.

The JobTypes.ThumbnailGenerator is correctly defined and used in the codebase. The add method in JobsService correctly handles adding jobs, including JobTypes.ThumbnailGenerator.

  • packages/nocodb/src/interface/Jobs.ts: ThumbnailGenerator = 'thumbnail-generator'
  • packages/nocodb/src/modules/jobs/fallback/jobs.service.ts: add method implementation
  • packages/nocodb/src/modules/jobs/redis/jobs.service.ts: add method implementation
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that `JobTypes.ThumbnailGenerator` is correctly used and the job is added to the `JobsService`.

# Test: Search for `JobTypes.ThumbnailGenerator` usage in the codebase. Expect: `JobTypes.ThumbnailGenerator` should be correctly used.
rg --type ts 'JobTypes.ThumbnailGenerator' packages/nocodb/src/

Length of output: 644


Script:

#!/bin/bash
# Find the definition of `JobTypes.ThumbnailGenerator`
rg --type ts 'ThumbnailGenerator' packages/nocodb/src/

# Locate the `add` method in `JobsService`
rg --type ts 'add(' packages/nocodb/src/services/jobs.service.ts -A 10

Length of output: 2120


Script:

#!/bin/bash
# Locate the `add` method in `JobsService`
rg --type ts 'add\(' packages/nocodb/src/services/jobs.service.ts -A 10

# Confirm the definition of `JobTypes.ThumbnailGenerator` in `Jobs.ts`
rg --type ts 'ThumbnailGenerator' packages/nocodb/src/interface/Jobs.ts

Length of output: 337


Script:

#!/bin/bash
# Locate the `add` method in the entire `packages/nocodb/src/` directory
rg --type ts 'add\(' packages/nocodb/src/ -A 10

Length of output: 48533


Script:

#!/bin/bash
# Extract the `add` method implementation from `fallback-queue.service.ts`
rg --type ts 'add\(' packages/nocodb/src/modules/jobs/fallback/fallback-queue.service.ts -A 20

# Extract the `add` method implementation from `fallback/jobs.service.ts`
rg --type ts 'add\(' packages/nocodb/src/modules/jobs/fallback/jobs.service.ts -A 20

# Extract the `add` method implementation from `redis/jobs.service.ts`
rg --type ts 'add\(' packages/nocodb/src/modules/jobs/redis/jobs.service.ts -A 20

Length of output: 2535

@o1lab o1lab force-pushed the nc-thumbnail-processor branch from 918d74e to caf3d0f Compare July 24, 2024 14:20
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 8

Outside diff range, codebase verification and nitpick comments (2)
packages/nocodb/src/plugins/storage/Local.ts (1)

Line range hint 33-57:
Change in response type to 'arraybuffer' for axios request.

The responseType has been changed from 'stream' to 'arraybuffer'. This change affects how data is handled after download: instead of being streamed directly to a file or another destination, it is now fully loaded into memory before processing.

This might introduce memory inefficiency issues, especially with large files. Consider reverting to 'stream' if handling large files is a common use case, or implement a conditional logic to choose the responseType based on file size.

Refactoring from createWriteStream to writeFile in file handling.

The file writing logic has been refactored from using fs.createWriteStream to fs.writeFile. This change simplifies the code but removes the benefits of streaming, which can handle large files better by not loading them completely into memory.

Consider using createWriteStream for better handling of large files or implement a check to decide the method based on file size.

- fs.writeFile(destPath, response.data, (err) => {
+ const writableStream = fs.createWriteStream(destPath);
+ writableStream.write(response.data, (err) => {
packages/nocodb/src/plugins/s3/S3.ts (1)

Line range hint 63-88:
Ensure proper error handling and return type consistency.

The fileCreateByStream method correctly handles asynchronous file uploads using promises. However, the return type in the method signature is Promise<void>, but the promise resolves with data. Update the return type to Promise<any> for consistency.

-  ): Promise<void> {
+  ): Promise<any> {
Tools
Biome

[error] 59-59: The catch clause that only rethrows the original error is redundant.

These unnecessary catch clauses can be confusing. It is recommended to remove them.

(lint/complexity/noUselessCatch)

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 918d74e and caf3d0f.

Files selected for processing (30)
  • packages/nc-gui/components/cell/attachment/Image.vue (1 hunks)
  • packages/nc-gui/components/cell/attachment/Modal.vue (1 hunks)
  • packages/nc-gui/components/cell/attachment/index.vue (2 hunks)
  • packages/nc-gui/components/smartsheet/Gallery.vue (1 hunks)
  • packages/nc-gui/components/smartsheet/Kanban.vue (1 hunks)
  • packages/nc-gui/components/smartsheet/calendar/SideMenu.vue (1 hunks)
  • packages/nc-gui/components/virtual-cell/components/ListItem.vue (1 hunks)
  • packages/nc-gui/composables/useAttachment.ts (1 hunks)
  • packages/nocodb/.gitignore (1 hunks)
  • packages/nocodb/src/controllers/attachments-secure.controller.ts (2 hunks)
  • packages/nocodb/src/controllers/attachments.controller.ts (4 hunks)
  • packages/nocodb/src/db/BaseModelSqlv2.ts (2 hunks)
  • packages/nocodb/src/interface/Jobs.ts (3 hunks)
  • packages/nocodb/src/modules/jobs/fallback/fallback-queue.service.ts (3 hunks)
  • packages/nocodb/src/modules/jobs/jobs.module.ts (2 hunks)
  • packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/thumbnail-generator.processor.ts (1 hunks)
  • packages/nocodb/src/modules/noco.module.ts (2 hunks)
  • packages/nocodb/src/plugins/backblaze/Backblaze.ts (3 hunks)
  • packages/nocodb/src/plugins/gcs/Gcs.ts (3 hunks)
  • packages/nocodb/src/plugins/linode/LinodeObjectStorage.ts (3 hunks)
  • packages/nocodb/src/plugins/mino/Minio.ts (3 hunks)
  • packages/nocodb/src/plugins/ovhCloud/OvhCloud.ts (3 hunks)
  • packages/nocodb/src/plugins/s3/S3.ts (3 hunks)
  • packages/nocodb/src/plugins/scaleway/ScalewayObjectStorage.ts (3 hunks)
  • packages/nocodb/src/plugins/spaces/Spaces.ts (3 hunks)
  • packages/nocodb/src/plugins/storage/Local.ts (2 hunks)
  • packages/nocodb/src/plugins/upcloud/UpoCloud.ts (3 hunks)
  • packages/nocodb/src/plugins/vultr/Vultr.ts (3 hunks)
  • packages/nocodb/src/services/attachments.service.ts (9 hunks)
  • packages/nocodb/src/services/public-datas.service.ts (7 hunks)
Files skipped from review as they are similar to previous changes (20)
  • packages/nc-gui/components/cell/attachment/Modal.vue
  • packages/nc-gui/components/cell/attachment/index.vue
  • packages/nc-gui/components/smartsheet/Gallery.vue
  • packages/nc-gui/components/smartsheet/Kanban.vue
  • packages/nc-gui/components/smartsheet/calendar/SideMenu.vue
  • packages/nc-gui/components/virtual-cell/components/ListItem.vue
  • packages/nc-gui/composables/useAttachment.ts
  • packages/nocodb/.gitignore
  • packages/nocodb/src/controllers/attachments-secure.controller.ts
  • packages/nocodb/src/controllers/attachments.controller.ts
  • packages/nocodb/src/db/BaseModelSqlv2.ts
  • packages/nocodb/src/interface/Jobs.ts
  • packages/nocodb/src/modules/jobs/fallback/fallback-queue.service.ts
  • packages/nocodb/src/modules/jobs/jobs.module.ts
  • packages/nocodb/src/modules/noco.module.ts
  • packages/nocodb/src/plugins/gcs/Gcs.ts
  • packages/nocodb/src/plugins/mino/Minio.ts
  • packages/nocodb/src/plugins/scaleway/ScalewayObjectStorage.ts
  • packages/nocodb/src/plugins/spaces/Spaces.ts
  • packages/nocodb/src/services/attachments.service.ts
Additional context used
Biome
packages/nocodb/src/plugins/s3/S3.ts

[error] 59-59: The catch clause that only rethrows the original error is redundant.

These unnecessary catch clauses can be confusing. It is recommended to remove them.

(lint/complexity/noUselessCatch)

Additional comments not posted (17)
packages/nc-gui/components/cell/attachment/Image.vue (2)

11-13: LGTM!

The explicit increment operation enhances clarity.


17-26: LGTM!

The changes improve robustness and error handling. However, remember to address the TODO comment regarding the <LazyNuxtImg> component.

packages/nocodb/src/plugins/vultr/Vultr.ts (1)

19-22: LGTM!

The refactoring centralizes the S3 upload logic, improving maintainability.

packages/nocodb/src/plugins/upcloud/UpoCloud.ts (1)

19-22: LGTM!

The changes improve the clarity and efficiency of file upload operations.

packages/nocodb/src/plugins/linode/LinodeObjectStorage.ts (1)

19-22: LGTM!

The fileCreate function correctly reads the file and calls fileCreateByStream.

packages/nocodb/src/plugins/ovhCloud/OvhCloud.ts (1)

19-22: LGTM!

The fileCreate function correctly reads the file and calls fileCreateByStream.

packages/nocodb/src/plugins/storage/Local.ts (1)

Line range hint 63-75:
LGTM!

The fileCreateByStream function correctly creates a writable stream and pipes the input stream to it.

packages/nocodb/src/plugins/backblaze/Backblaze.ts (1)

19-22: LGTM! The changes improve modularity and readability.

The method now correctly delegates the upload process to fileCreateByStream and passes the MIME type.

packages/nocodb/src/plugins/s3/S3.ts (1)

32-34: LGTM! The changes improve modularity and readability.

The method now correctly delegates the upload process to fileCreateByStream and passes the MIME type.

packages/nocodb/src/services/public-datas.service.ts (8)

2-3: LGTM! Import statements are appropriate.

The added imports for sharp, IJobsService, JobTypes, and RootScopes are necessary for the new thumbnail generation feature and are correctly included.

Also applies to: 8-8, 22-24


33-36: LGTM! Constructor for JobsService injection is correct.

The constructor correctly injects the JobsService using dependency injection.


417-421: Initialize tempMeta object with default values.

To avoid potential issues with undefined values, initialize the tempMeta object with default values.

-        const tempMeta: {
-          width?: number;
-          height?: number;
-        } = {};
+        const tempMeta: {
+          width: number;
+          height: number;
+        } = { width: 0, height: 0 };

422-432: Handle image metadata extraction errors gracefully.

Ensure that any errors during image metadata extraction are logged for debugging purposes.

-          } catch (e) {
-            // Ignore-if file is not image
-          }
+          } catch (e) {
+            console.error('Error extracting image metadata:', e);
+          }

496-500: Initialize tempMetadata object with default values.

To avoid potential issues with undefined values, initialize the tempMetadata object with default values.

-      const tempMetadata: {
-        width?: number;
-        height?: number;
-      } = {};
+      const tempMetadata: {
+        width: number;
+        height: number;
+      } = { width: 0, height: 0 };

501-513: Handle image metadata extraction errors gracefully.

Ensure that any errors during image metadata extraction are logged for debugging purposes.

-      } catch (e) {
-        // Might be invalid image - ignore
-      }
+      } catch (e) {
+        console.error('Error extracting image metadata:', e);
+      }

456-456: LGTM! Metadata inclusion in attachments is correct.

The inclusion of extracted metadata in the attachment objects is correct.

Also applies to: 534-534


542-548: LGTM! But verify the job type handling in JobsService.

The code changes for adding the thumbnail generation job are approved.

However, ensure that the job type ThumbnailGenerator is correctly handled in the JobsService.

Verification successful

Let's generate a new script to search for the handling of JobTypes.ThumbnailGenerator in the codebase.


The job type ThumbnailGenerator is handled correctly in the JobsService.

The search results confirm that JobTypes.ThumbnailGenerator is integrated and processed properly in the job processing system.

  • thumbnail-generator.processor.ts: The job type is processed.
  • fallback-queue.service.ts: The job type is included in the fallback queue.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the job type `ThumbnailGenerator` handling in `JobsService`.

# Test: Search for the job type handling. Expect: Proper handling of `ThumbnailGenerator`.
rg --type typescript -A 5 $'JobTypes.ThumbnailGenerator'

Length of output: 90


Script:

#!/bin/bash
# Description: Verify the job type `ThumbnailGenerator` handling in `JobsService`.

# Test: Search for the job type handling. Expect: Proper handling of `ThumbnailGenerator`.
rg 'JobTypes.ThumbnailGenerator' -A 5

Length of output: 2833

@o1lab o1lab force-pushed the nc-thumbnail-processor branch from caf3d0f to 77bc13b Compare July 24, 2024 15:40
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 9

Outside diff range, codebase verification and nitpick comments (2)
packages/nocodb/src/plugins/storage/Local.ts (1)

Line range hint 33-57:
Consider reverting to 'stream' for responseType and using createWriteStream for better handling of large files.

The change in response type to 'arraybuffer' might introduce memory inefficiency issues, especially with large files. The change in file writing logic removes the benefits of streaming, which can handle large files better by not loading them completely into memory.

- responseType: 'arraybuffer',
+ responseType: 'stream',

- fs.writeFile(destPath, response.data, (err) => {
+ const writableStream = fs.createWriteStream(destPath);
+ response.data.pipe(writableStream);
+ writableStream.on('finish', () => resolve({
+   url: null,
+   data: response.data,
+ }));
+ writableStream.on('error', (err) => reject(err));
packages/nocodb/src/plugins/s3/S3.ts (1)

Line range hint 63-82:
Simplify the promise wrapper using async/await.

The method can be simplified by removing the unnecessary promise wrapper and using async/await for better readability and error handling.

-  return new Promise((resolve, reject) => {
-    stream.on('error', (err) => {
-      console.log('File Error', err);
-      reject(err);
-    });
-    const uploadParams: any = {
-      ...this.defaultParams,
-      Body: stream,
-      Key: key,
-      ContentType: options?.mimetype || 'application/octet-stream',
-    };
-    this.upload(uploadParams)
-      .then((data) => {
-        resolve(data);
-      })
-      .catch((err) => {
-        reject(err);
-      });
-  });
+  try {
+    stream.on('error', (err) => {
+      console.log('File Error', err);
+      throw err;
+    });
+    const uploadParams: any = {
+      ...this.defaultParams,
+      Body: stream,
+      Key: key,
+      ContentType: options?.mimetype || 'application/octet-stream',
+    };
+    const data = await this.upload(uploadParams);
+    return data;
+  } catch (err) {
+    console.log('Error', err);
+    throw err;
+  }
Tools
Biome

[error] 59-59: The catch clause that only rethrows the original error is redundant.

These unnecessary catch clauses can be confusing. It is recommended to remove them.

(lint/complexity/noUselessCatch)

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between caf3d0f and 77bc13b.

Files selected for processing (30)
  • packages/nc-gui/components/cell/attachment/Image.vue (1 hunks)
  • packages/nc-gui/components/cell/attachment/Modal.vue (1 hunks)
  • packages/nc-gui/components/cell/attachment/index.vue (2 hunks)
  • packages/nc-gui/components/smartsheet/Gallery.vue (1 hunks)
  • packages/nc-gui/components/smartsheet/Kanban.vue (1 hunks)
  • packages/nc-gui/components/smartsheet/calendar/SideMenu.vue (1 hunks)
  • packages/nc-gui/components/virtual-cell/components/ListItem.vue (1 hunks)
  • packages/nc-gui/composables/useAttachment.ts (1 hunks)
  • packages/nocodb/.gitignore (1 hunks)
  • packages/nocodb/src/controllers/attachments-secure.controller.ts (2 hunks)
  • packages/nocodb/src/controllers/attachments.controller.ts (4 hunks)
  • packages/nocodb/src/db/BaseModelSqlv2.ts (2 hunks)
  • packages/nocodb/src/interface/Jobs.ts (3 hunks)
  • packages/nocodb/src/modules/jobs/fallback/fallback-queue.service.ts (3 hunks)
  • packages/nocodb/src/modules/jobs/jobs.module.ts (2 hunks)
  • packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/thumbnail-generator.processor.ts (1 hunks)
  • packages/nocodb/src/modules/noco.module.ts (2 hunks)
  • packages/nocodb/src/plugins/backblaze/Backblaze.ts (3 hunks)
  • packages/nocodb/src/plugins/gcs/Gcs.ts (3 hunks)
  • packages/nocodb/src/plugins/linode/LinodeObjectStorage.ts (3 hunks)
  • packages/nocodb/src/plugins/mino/Minio.ts (3 hunks)
  • packages/nocodb/src/plugins/ovhCloud/OvhCloud.ts (3 hunks)
  • packages/nocodb/src/plugins/s3/S3.ts (3 hunks)
  • packages/nocodb/src/plugins/scaleway/ScalewayObjectStorage.ts (3 hunks)
  • packages/nocodb/src/plugins/spaces/Spaces.ts (3 hunks)
  • packages/nocodb/src/plugins/storage/Local.ts (2 hunks)
  • packages/nocodb/src/plugins/upcloud/UpoCloud.ts (3 hunks)
  • packages/nocodb/src/plugins/vultr/Vultr.ts (3 hunks)
  • packages/nocodb/src/services/attachments.service.ts (9 hunks)
  • packages/nocodb/src/services/public-datas.service.ts (7 hunks)
Files skipped from review as they are similar to previous changes (20)
  • packages/nc-gui/components/cell/attachment/Modal.vue
  • packages/nc-gui/components/cell/attachment/index.vue
  • packages/nc-gui/components/smartsheet/Gallery.vue
  • packages/nc-gui/components/smartsheet/Kanban.vue
  • packages/nc-gui/components/smartsheet/calendar/SideMenu.vue
  • packages/nc-gui/components/virtual-cell/components/ListItem.vue
  • packages/nc-gui/composables/useAttachment.ts
  • packages/nocodb/.gitignore
  • packages/nocodb/src/controllers/attachments-secure.controller.ts
  • packages/nocodb/src/db/BaseModelSqlv2.ts
  • packages/nocodb/src/interface/Jobs.ts
  • packages/nocodb/src/modules/jobs/fallback/fallback-queue.service.ts
  • packages/nocodb/src/modules/jobs/jobs.module.ts
  • packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/thumbnail-generator.processor.ts
  • packages/nocodb/src/modules/noco.module.ts
  • packages/nocodb/src/plugins/gcs/Gcs.ts
  • packages/nocodb/src/plugins/linode/LinodeObjectStorage.ts
  • packages/nocodb/src/plugins/scaleway/ScalewayObjectStorage.ts
  • packages/nocodb/src/plugins/spaces/Spaces.ts
  • packages/nocodb/src/services/attachments.service.ts
Additional context used
Biome
packages/nocodb/src/plugins/s3/S3.ts

[error] 59-59: The catch clause that only rethrows the original error is redundant.

These unnecessary catch clauses can be confusing. It is recommended to remove them.

(lint/complexity/noUselessCatch)

Additional comments not posted (16)
packages/nc-gui/components/cell/attachment/Image.vue (2)

11-13: LGTM!

The explicit increment operation improves code clarity.


17-26: LGTM!

The changes in the <img> element resolve issues with error handling and ensure robustness.

Reminder: Fix the issue with <LazyNuxtImg>.

The TODO comment indicates that the issue with <LazyNuxtImg> needs to be fixed.

packages/nocodb/src/plugins/vultr/Vultr.ts (1)

19-22: LGTM!

Centralizing the S3 upload logic within fileCreateByStream improves code reuse and maintainability.

packages/nocodb/src/plugins/ovhCloud/OvhCloud.ts (1)

19-22: LGTM! The refactoring simplifies the code.

The refactoring of the fileCreate method to use the fileCreateByStream method is logical and simplifies the code.

packages/nocodb/src/plugins/backblaze/Backblaze.ts (1)

19-22: LGTM! The refactoring simplifies the code.

The refactoring of the fileCreate method to use the fileCreateByStream method is logical and simplifies the code.

packages/nocodb/src/plugins/mino/Minio.ts (1)

19-21: LGTM! The changes improve code reuse and return value.

The function now reuses the fileCreateByStream method and provides more information in the return value.

packages/nocodb/src/plugins/s3/S3.ts (1)

32-34: LGTM! The changes improve code reuse and return value.

The function now reuses the fileCreateByStream method and provides more information in the return value.

packages/nocodb/src/services/public-datas.service.ts (9)

2-2: LGTM! Dependency injection imports added.

The imports for forwardRef, Inject, and Injectable from @nestjs/common are correctly added to support dependency injection.


8-8: LGTM! Sharp library imported for image processing.

The import of the sharp library is appropriate for handling image processing tasks required for the thumbnail generator feature.


22-24: LGTM! Job-related imports added.

The imports for IJobsService, JobTypes, and RootScopes are correctly added to support job management for the thumbnail generator feature.


33-36: LGTM! Constructor added for dependency injection.

The constructor correctly injects the JobsService using NestJS's dependency injection mechanism.


417-421: Initialize tempMeta object with default values.

To avoid potential issues with undefined values, initialize the tempMeta object with default values.

-        const tempMeta: {
-          width?: number;
-          height?: number;
-        } = {};
+        const tempMeta: {
+          width: number;
+          height: number;
+        } = { width: 0, height: 0 };

422-432: Handle image metadata extraction errors gracefully.

Ensure that any errors during image metadata extraction are logged for debugging purposes.

-          } catch (e) {
-            // Ignore-if file is not image
-          }
+          } catch (e) {
+            console.error('Error extracting image metadata:', e);
+          }

496-500: Initialize tempMetadata object with default values.

To avoid potential issues with undefined values, initialize the tempMetadata object with default values.

-      const tempMetadata: {
-        width?: number;
-        height?: number;
-      } = {};
+      const tempMetadata: {
+        width: number;
+        height: number;
+      } = { width: 0, height: 0 };

501-513: Handle image metadata extraction errors gracefully.

Ensure that any errors during image metadata extraction are logged for debugging purposes.

-      } catch (e) {
-        // Might be invalid image - ignore
-      }
+      } catch (e) {
+        console.error('Error extracting image metadata:', e);
+      }

542-548: LGTM! Job for thumbnail generation added.

The addition of a job for thumbnail generation using JobsService aligns with the PR's objective and is correctly implemented.

@o1lab o1lab force-pushed the nc-thumbnail-processor branch from 77bc13b to e940832 Compare July 25, 2024 05:28
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 15

Outside diff range, codebase verification and nitpick comments (2)
packages/nc-gui/components/cell/attachment/Preview/Image.vue (1)

15-32: Reminder: Address the TODO comment.

The TODO comment indicates a known issue with the nuxt-image component. Ensure to fix this later as mentioned.

packages/nocodb/src/plugins/s3/S3.ts (1)

Line range hint 63-82:
Simplify the promise wrapper using async/await.

The method can be simplified by removing the unnecessary promise wrapper and using async/await for better readability and error handling.

-  return new Promise((resolve, reject) => {
-    stream.on('error', (err) => {
-      console.log('File Error', err);
-      reject(err);
-    });
-
-    uploadParams.Body = stream;
-    uploadParams.Key = key;
-    uploadParams.ContentType =
-      options?.mimetype || 'application/octet-stream';
-
-    // call S3 to upload file to specified bucket
-    this.upload(uploadParams)
-      .then((data) => {
-        resolve(data);
-      })
-      .catch((err) => {
-        reject(err);
-      });
-  });
+  try {
+    stream.on('error', (err) => {
+      console.log('File Error', err);
+      throw err;
+    });
+
+    uploadParams.Body = stream;
+    uploadParams.Key = key;
+    uploadParams.ContentType =
+      options?.mimetype || 'application/octet-stream';
+
+    // call S3 to upload file to specified bucket
+    const data = await this.upload(uploadParams);
+    return data;
+  } catch (err) {
+    console.log('Error', err);
+    throw err;
+  }
Tools
Biome

[error] 59-59: The catch clause that only rethrows the original error is redundant.

These unnecessary catch clauses can be confusing. It is recommended to remove them.

(lint/complexity/noUselessCatch)

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 77bc13b and e940832.

Files selected for processing (31)
  • packages/nc-gui/components/cell/attachment/Carousel.vue (1 hunks)
  • packages/nc-gui/components/cell/attachment/Modal.vue (2 hunks)
  • packages/nc-gui/components/cell/attachment/Preview/Image.vue (1 hunks)
  • packages/nc-gui/components/cell/attachment/index.vue (3 hunks)
  • packages/nc-gui/components/smartsheet/Gallery.vue (1 hunks)
  • packages/nc-gui/components/smartsheet/Kanban.vue (1 hunks)
  • packages/nc-gui/components/smartsheet/calendar/SideMenu.vue (1 hunks)
  • packages/nc-gui/components/virtual-cell/components/ListItem.vue (1 hunks)
  • packages/nc-gui/composables/useAttachment.ts (1 hunks)
  • packages/nocodb/.gitignore (1 hunks)
  • packages/nocodb/src/controllers/attachments-secure.controller.ts (2 hunks)
  • packages/nocodb/src/controllers/attachments.controller.ts (4 hunks)
  • packages/nocodb/src/db/BaseModelSqlv2.ts (2 hunks)
  • packages/nocodb/src/interface/Jobs.ts (3 hunks)
  • packages/nocodb/src/modules/jobs/fallback/fallback-queue.service.ts (3 hunks)
  • packages/nocodb/src/modules/jobs/jobs.module.ts (2 hunks)
  • packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/thumbnail-generator.processor.ts (1 hunks)
  • packages/nocodb/src/modules/noco.module.ts (2 hunks)
  • packages/nocodb/src/plugins/backblaze/Backblaze.ts (3 hunks)
  • packages/nocodb/src/plugins/gcs/Gcs.ts (3 hunks)
  • packages/nocodb/src/plugins/linode/LinodeObjectStorage.ts (3 hunks)
  • packages/nocodb/src/plugins/mino/Minio.ts (3 hunks)
  • packages/nocodb/src/plugins/ovhCloud/OvhCloud.ts (3 hunks)
  • packages/nocodb/src/plugins/s3/S3.ts (3 hunks)
  • packages/nocodb/src/plugins/scaleway/ScalewayObjectStorage.ts (3 hunks)
  • packages/nocodb/src/plugins/spaces/Spaces.ts (3 hunks)
  • packages/nocodb/src/plugins/storage/Local.ts (2 hunks)
  • packages/nocodb/src/plugins/upcloud/UpoCloud.ts (3 hunks)
  • packages/nocodb/src/plugins/vultr/Vultr.ts (3 hunks)
  • packages/nocodb/src/services/attachments.service.ts (9 hunks)
  • packages/nocodb/src/services/public-datas.service.ts (7 hunks)
Files skipped from review as they are similar to previous changes (18)
  • packages/nc-gui/components/cell/attachment/index.vue
  • packages/nc-gui/components/smartsheet/Gallery.vue
  • packages/nc-gui/components/smartsheet/Kanban.vue
  • packages/nc-gui/components/smartsheet/calendar/SideMenu.vue
  • packages/nc-gui/components/virtual-cell/components/ListItem.vue
  • packages/nc-gui/composables/useAttachment.ts
  • packages/nocodb/.gitignore
  • packages/nocodb/src/controllers/attachments-secure.controller.ts
  • packages/nocodb/src/interface/Jobs.ts
  • packages/nocodb/src/modules/jobs/fallback/fallback-queue.service.ts
  • packages/nocodb/src/modules/jobs/jobs.module.ts
  • packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/thumbnail-generator.processor.ts
  • packages/nocodb/src/modules/noco.module.ts
  • packages/nocodb/src/plugins/gcs/Gcs.ts
  • packages/nocodb/src/plugins/linode/LinodeObjectStorage.ts
  • packages/nocodb/src/plugins/scaleway/ScalewayObjectStorage.ts
  • packages/nocodb/src/plugins/spaces/Spaces.ts
  • packages/nocodb/src/services/attachments.service.ts
Additional context used
Biome
packages/nocodb/src/plugins/s3/S3.ts

[error] 59-59: The catch clause that only rethrows the original error is redundant.

These unnecessary catch clauses can be confusing. It is recommended to remove them.

(lint/complexity/noUselessCatch)

Additional comments not posted (19)
packages/nc-gui/components/cell/attachment/Preview/Image.vue (3)

1-13: LGTM!

The script setup block is clean and follows best practices. Props are well-defined, and the error handling function is implemented correctly.


15-32: LGTM!

The template block is well-configured with lazy loading and error handling for the image element.


33-33: LGTM!

The template block closes correctly.

packages/nocodb/src/plugins/vultr/Vultr.ts (2)

50-53: LGTM!

The fileCreateByUrl method is well-implemented with proper error handling and structured response.


63-87: Ensure proper return type consistency.

The fileCreateByStream method resolves with data.Location, but the return type is Promise<void>. Update the return type to Promise<any> for consistency.

-  ): Promise<void> {
+  ): Promise<any> {

Likely invalid or redundant comment.

packages/nocodb/src/plugins/upcloud/UpoCloud.ts (1)

50-53: LGTM!

The fileCreateByUrl method is well-implemented with proper error handling and structured response.

packages/nocodb/src/plugins/ovhCloud/OvhCloud.ts (1)

19-22: LGTM! Simplified the upload process.

The changes simplify the upload process by directly creating a file stream and passing it to fileCreateByStream. The MIME type is handled through an optional parameter.

packages/nocodb/src/plugins/backblaze/Backblaze.ts (1)

19-22: LGTM! Simplified the upload process.

The changes simplify the upload process by directly creating a file stream and passing it to fileCreateByStream. The MIME type is handled through an optional parameter.

packages/nocodb/src/plugins/mino/Minio.ts (1)

19-21: LGTM!

The changes to the fileCreate method are clear and improve the utility by returning more information.

packages/nocodb/src/plugins/s3/S3.ts (1)

32-34: LGTM!

The changes to the fileCreate method are clear and improve the utility by returning more information.

packages/nc-gui/components/cell/attachment/Carousel.vue (2)

84-134: Enhanced carousel functionality and structured layout.

The additions of NcButton and NcCarousel components improve the carousel's functionality and user interface. Ensure that these components are thoroughly tested for various attachment types.


135-150: Enhanced user interaction with tooltips and rename buttons.

The additions of tooltips and buttons for renaming files enrich user interaction capabilities within the carousel. Ensure that the conditions for displaying the rename functionality are tested under various scenarios.

packages/nc-gui/components/cell/attachment/Modal.vue (2)

37-37: Optimized image source management with additional parameter.

The addition of the 'card_cover' parameter to the getPossibleAttachmentSrc method optimizes image previews within the modal. Ensure that the method is tested with various attachment types to verify the correct image source retrieval.


116-133: Enhanced modal functionality with checkboxes and optimized image previews.

The additions of NcCheckbox and LazyCellAttachmentPreviewImage components enhance the modal's functionality. Ensure that these components are thoroughly tested for various attachment types and scenarios.

packages/nocodb/src/services/public-datas.service.ts (4)

2-8: Integrated necessary dependencies for new functionality.

The additions of forwardRef, Inject, Injectable, and sharp imports integrate necessary dependencies for image processing and job management. Ensure that these dependencies are correctly configured and utilized.


22-24: Integrated additional dependencies for job management and global scope handling.

The additions of IJobsService, JobTypes, and RootScopes imports integrate additional dependencies for job management and global scope handling. Ensure that these dependencies are correctly configured and utilized.


33-36: Enhanced job management capabilities with JobsService injection.

The addition of a constructor for injecting JobsService enhances job management capabilities within the PublicDatasService class. Ensure that the JobsService is correctly injected and utilized across the class.


542-548: Enhanced file creation process with thumbnail generation job.

The addition of a job for generating thumbnails using the JobsService enhances the file creation process. Ensure that the job is correctly configured and tested for various attachment types.

packages/nocodb/src/db/BaseModelSqlv2.ts (1)

8596-8597: Ensure width and height properties are correctly handled

The addition of width and height properties to attachments should be verified for correctness. Ensure that these properties are correctly extracted and validated.

@o1lab o1lab force-pushed the nc-thumbnail-processor branch from e940832 to 436bc5f Compare July 25, 2024 05:35
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 12

Outside diff range, codebase verification and nitpick comments (2)
packages/nc-gui/components/cell/attachment/Preview/Image.vue (1)

Line range hint 1-10:
Handle the case where all images fail to load.

The onError function should handle the case where all images in the srcs array fail to load to prevent an infinite loop.

- const onError = () => index.value++
+ const onError = () => {
+   if (index.value < props.srcs.length - 1) {
+     index.value++
+   }
+ }
packages/nocodb/src/plugins/s3/S3.ts (1)

Line range hint 63-88:
Simplify the promise wrapper using async/await and verify error handling.

The fileCreateByStream method can be simplified by removing the unnecessary promise wrapper and using async/await for better readability and error handling.

-  return new Promise((resolve, reject) => {
-    stream.on('error', (err) => {
-      console.log('File Error', err);
-      reject(err);
-    });
-    uploadParams.Body = stream;
-    uploadParams.Key = key;
-    uploadParams.ContentType = options?.mimetype || 'application/octet-stream';
-    this.upload(uploadParams)
-      .then((data) => {
-        resolve(data);
-      })
-      .catch((err) => {
-        reject(err);
-      });
-  });
+  try {
+    stream.on('error', (err) => {
+      console.log('File Error', err);
+      throw err;
+    });
+    uploadParams.Body = stream;
+    uploadParams.Key = key;
+    uploadParams.ContentType = options?.mimetype || 'application/octet-stream';
+    const data = await this.upload(uploadParams);
+    return data;
+  } catch (err) {
+    console.log('Error', err);
+    throw err;
+  }
Tools
Biome

[error] 59-59: The catch clause that only rethrows the original error is redundant.

These unnecessary catch clauses can be confusing. It is recommended to remove them.

(lint/complexity/noUselessCatch)

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e940832 and 436bc5f.

Files selected for processing (31)
  • packages/nc-gui/components/cell/attachment/Carousel.vue (1 hunks)
  • packages/nc-gui/components/cell/attachment/Modal.vue (2 hunks)
  • packages/nc-gui/components/cell/attachment/Preview/Image.vue (1 hunks)
  • packages/nc-gui/components/cell/attachment/index.vue (5 hunks)
  • packages/nc-gui/components/smartsheet/Gallery.vue (1 hunks)
  • packages/nc-gui/components/smartsheet/Kanban.vue (1 hunks)
  • packages/nc-gui/components/smartsheet/calendar/SideMenu.vue (1 hunks)
  • packages/nc-gui/components/virtual-cell/components/ListItem.vue (1 hunks)
  • packages/nc-gui/composables/useAttachment.ts (1 hunks)
  • packages/nocodb/.gitignore (1 hunks)
  • packages/nocodb/src/controllers/attachments-secure.controller.ts (2 hunks)
  • packages/nocodb/src/controllers/attachments.controller.ts (4 hunks)
  • packages/nocodb/src/db/BaseModelSqlv2.ts (2 hunks)
  • packages/nocodb/src/interface/Jobs.ts (3 hunks)
  • packages/nocodb/src/modules/jobs/fallback/fallback-queue.service.ts (3 hunks)
  • packages/nocodb/src/modules/jobs/jobs.module.ts (2 hunks)
  • packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/thumbnail-generator.processor.ts (1 hunks)
  • packages/nocodb/src/modules/noco.module.ts (2 hunks)
  • packages/nocodb/src/plugins/backblaze/Backblaze.ts (3 hunks)
  • packages/nocodb/src/plugins/gcs/Gcs.ts (3 hunks)
  • packages/nocodb/src/plugins/linode/LinodeObjectStorage.ts (3 hunks)
  • packages/nocodb/src/plugins/mino/Minio.ts (3 hunks)
  • packages/nocodb/src/plugins/ovhCloud/OvhCloud.ts (3 hunks)
  • packages/nocodb/src/plugins/s3/S3.ts (3 hunks)
  • packages/nocodb/src/plugins/scaleway/ScalewayObjectStorage.ts (3 hunks)
  • packages/nocodb/src/plugins/spaces/Spaces.ts (3 hunks)
  • packages/nocodb/src/plugins/storage/Local.ts (2 hunks)
  • packages/nocodb/src/plugins/upcloud/UpoCloud.ts (3 hunks)
  • packages/nocodb/src/plugins/vultr/Vultr.ts (3 hunks)
  • packages/nocodb/src/services/attachments.service.ts (9 hunks)
  • packages/nocodb/src/services/public-datas.service.ts (7 hunks)
Files skipped from review as they are similar to previous changes (23)
  • packages/nc-gui/components/cell/attachment/Carousel.vue
  • packages/nc-gui/components/cell/attachment/Modal.vue
  • packages/nc-gui/components/cell/attachment/index.vue
  • packages/nc-gui/components/smartsheet/Gallery.vue
  • packages/nc-gui/components/smartsheet/Kanban.vue
  • packages/nc-gui/components/smartsheet/calendar/SideMenu.vue
  • packages/nc-gui/components/virtual-cell/components/ListItem.vue
  • packages/nc-gui/composables/useAttachment.ts
  • packages/nocodb/.gitignore
  • packages/nocodb/src/controllers/attachments-secure.controller.ts
  • packages/nocodb/src/db/BaseModelSqlv2.ts
  • packages/nocodb/src/interface/Jobs.ts
  • packages/nocodb/src/modules/jobs/fallback/fallback-queue.service.ts
  • packages/nocodb/src/modules/jobs/jobs.module.ts
  • packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/thumbnail-generator.processor.ts
  • packages/nocodb/src/modules/noco.module.ts
  • packages/nocodb/src/plugins/gcs/Gcs.ts
  • packages/nocodb/src/plugins/linode/LinodeObjectStorage.ts
  • packages/nocodb/src/plugins/mino/Minio.ts
  • packages/nocodb/src/plugins/scaleway/ScalewayObjectStorage.ts
  • packages/nocodb/src/plugins/spaces/Spaces.ts
  • packages/nocodb/src/plugins/storage/Local.ts
  • packages/nocodb/src/services/attachments.service.ts
Additional context used
Biome
packages/nocodb/src/plugins/s3/S3.ts

[error] 59-59: The catch clause that only rethrows the original error is redundant.

These unnecessary catch clauses can be confusing. It is recommended to remove them.

(lint/complexity/noUselessCatch)

Additional comments not posted (7)
packages/nc-gui/components/cell/attachment/Preview/Image.vue (1)

16-29: LGTM!

The template section correctly handles image loading errors and provides a fallback component.

packages/nocodb/src/plugins/ovhCloud/OvhCloud.ts (1)

19-22: LGTM! But verify the method usage in the codebase.

The code changes are approved.

However, ensure that all calls to fileCreate correctly pass the file object with the mimetype property.

Verification successful

LGTM! The method usage has been verified and all calls to fileCreate correctly pass the file object with the mimetype property.

  • All instances of fileCreate correctly include the mimetype property.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all calls to `fileCreate` pass the file object with the `mimetype` property.

# Test: Search for the method usage. Expect: Only occurances of the new signature.
rg --type python -A 5 $'fileCreate'

Length of output: 65


Script:

#!/bin/bash
# Description: Verify all calls to `fileCreate` pass the file object with the `mimetype` property.

# Test: Search for the method usage. Expect: Only occurrences of the new signature.
rg --type typescript -A 5 'fileCreate'

Length of output: 73


Script:

#!/bin/bash
# Description: Verify all calls to `fileCreate` pass the file object with the `mimetype` property.

# Test: Search for the method usage. Expect: Only occurrences of the new signature.
rg --type ts -A 5 'fileCreate'

Length of output: 28665

packages/nocodb/src/plugins/backblaze/Backblaze.ts (1)

19-22: LGTM! But verify the method usage in the codebase.

The code changes are approved.

However, ensure that all calls to fileCreate correctly pass the file object with the mimetype property.

Verification successful

LGTM! The fileCreate method is correctly called with the file object containing the mimetype property across the codebase.

  • Instances in attachments.service.ts, public-datas.service.ts, LinodeObjectStorage.ts, Vultr.ts, Backblaze.ts, UpoCloud.ts, ScalewayObjectStorage.ts, Spaces.ts, S3.ts, Gcs.ts, OvhCloud.ts, Minio.ts, Local.ts, and IStorageAdapter.ts confirm the correct usage.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all calls to `fileCreate` pass the file object with the `mimetype` property.

# Test: Search for the method usage. Expect: Only occurances of the new signature.
rg --type python -A 5 $'fileCreate'

Length of output: 65


Script:

#!/bin/bash
# Description: Verify all calls to `fileCreate` pass the file object with the `mimetype` property.

# Test: Search for the method usage. Expect: Only occurrences of the new signature.
rg --type ts -A 5 'fileCreate'

Length of output: 28665

packages/nocodb/src/controllers/attachments.controller.ts (1)

168-169: LGTM!

The introduction of the filePath variable enhances flexibility in path construction.

packages/nocodb/src/services/public-datas.service.ts (3)

8-8: LGTM!

The import of the sharp library for image processing is appropriate.


33-36: LGTM!

The constructor correctly uses dependency injection to inject the JobsService.


542-548: LGTM!

The addition of the job for thumbnail generation is appropriate and correctly implemented.

@o1lab o1lab force-pushed the nc-thumbnail-processor branch from 436bc5f to c071df4 Compare July 25, 2024 10:29
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 11

Outside diff range, codebase verification and nitpick comments (1)
packages/nocodb/src/plugins/s3/S3.ts (1)

Line range hint 63-88:
Simplify the promise wrapper using async/await.

The fileCreateByStream method can be simplified by removing the unnecessary promise wrapper and using async/await for better readability and error handling.

-  return new Promise((resolve, reject) => {
-    stream.on('error', (err) => {
-      console.log('File Error', err);
-      reject(err);
-    });
-    uploadParams.Body = stream;
-    uploadParams.Key = key;
-    uploadParams.ContentType = options?.mimetype || 'application/octet-stream';
-    this.upload(uploadParams)
-      .then((data) => {
-        resolve(data);
-      })
-      .catch((err) => {
-        reject(err);
-      });
-  });
+  try {
+    stream.on('error', (err) => {
+      console.log('File Error', err);
+      throw err;
+    });
+    uploadParams.Body = stream;
+    uploadParams.Key = key;
+    uploadParams.ContentType = options?.mimetype || 'application/octet-stream';
+    const data = await this.upload(uploadParams);
+    return data;
+  } catch (err) {
+    throw err;
+  }
Tools
Biome

[error] 59-59: The catch clause that only rethrows the original error is redundant.

These unnecessary catch clauses can be confusing. It is recommended to remove them.

(lint/complexity/noUselessCatch)

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 436bc5f and c071df4.

Files selected for processing (31)
  • packages/nc-gui/components/cell/attachment/Carousel.vue (1 hunks)
  • packages/nc-gui/components/cell/attachment/Modal.vue (2 hunks)
  • packages/nc-gui/components/cell/attachment/Preview/Image.vue (1 hunks)
  • packages/nc-gui/components/cell/attachment/index.vue (5 hunks)
  • packages/nc-gui/components/smartsheet/Gallery.vue (1 hunks)
  • packages/nc-gui/components/smartsheet/Kanban.vue (1 hunks)
  • packages/nc-gui/components/smartsheet/calendar/SideMenu.vue (1 hunks)
  • packages/nc-gui/components/virtual-cell/components/ListItem.vue (1 hunks)
  • packages/nc-gui/composables/useAttachment.ts (1 hunks)
  • packages/nocodb/.gitignore (1 hunks)
  • packages/nocodb/src/controllers/attachments-secure.controller.ts (2 hunks)
  • packages/nocodb/src/controllers/attachments.controller.ts (4 hunks)
  • packages/nocodb/src/db/BaseModelSqlv2.ts (2 hunks)
  • packages/nocodb/src/interface/Jobs.ts (3 hunks)
  • packages/nocodb/src/modules/jobs/fallback/fallback-queue.service.ts (3 hunks)
  • packages/nocodb/src/modules/jobs/jobs.module.ts (2 hunks)
  • packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/thumbnail-generator.processor.ts (1 hunks)
  • packages/nocodb/src/modules/noco.module.ts (2 hunks)
  • packages/nocodb/src/plugins/backblaze/Backblaze.ts (3 hunks)
  • packages/nocodb/src/plugins/gcs/Gcs.ts (3 hunks)
  • packages/nocodb/src/plugins/linode/LinodeObjectStorage.ts (3 hunks)
  • packages/nocodb/src/plugins/mino/Minio.ts (3 hunks)
  • packages/nocodb/src/plugins/ovhCloud/OvhCloud.ts (3 hunks)
  • packages/nocodb/src/plugins/s3/S3.ts (3 hunks)
  • packages/nocodb/src/plugins/scaleway/ScalewayObjectStorage.ts (3 hunks)
  • packages/nocodb/src/plugins/spaces/Spaces.ts (3 hunks)
  • packages/nocodb/src/plugins/storage/Local.ts (2 hunks)
  • packages/nocodb/src/plugins/upcloud/UpoCloud.ts (3 hunks)
  • packages/nocodb/src/plugins/vultr/Vultr.ts (3 hunks)
  • packages/nocodb/src/services/attachments.service.ts (9 hunks)
  • packages/nocodb/src/services/public-datas.service.ts (7 hunks)
Files skipped from review as they are similar to previous changes (23)
  • packages/nc-gui/components/cell/attachment/Carousel.vue
  • packages/nc-gui/components/cell/attachment/Modal.vue
  • packages/nc-gui/components/cell/attachment/index.vue
  • packages/nc-gui/components/smartsheet/Gallery.vue
  • packages/nc-gui/components/smartsheet/Kanban.vue
  • packages/nc-gui/components/smartsheet/calendar/SideMenu.vue
  • packages/nc-gui/components/virtual-cell/components/ListItem.vue
  • packages/nc-gui/composables/useAttachment.ts
  • packages/nocodb/.gitignore
  • packages/nocodb/src/controllers/attachments-secure.controller.ts
  • packages/nocodb/src/db/BaseModelSqlv2.ts
  • packages/nocodb/src/interface/Jobs.ts
  • packages/nocodb/src/modules/jobs/fallback/fallback-queue.service.ts
  • packages/nocodb/src/modules/jobs/jobs.module.ts
  • packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/thumbnail-generator.processor.ts
  • packages/nocodb/src/modules/noco.module.ts
  • packages/nocodb/src/plugins/gcs/Gcs.ts
  • packages/nocodb/src/plugins/linode/LinodeObjectStorage.ts
  • packages/nocodb/src/plugins/mino/Minio.ts
  • packages/nocodb/src/plugins/scaleway/ScalewayObjectStorage.ts
  • packages/nocodb/src/plugins/spaces/Spaces.ts
  • packages/nocodb/src/plugins/storage/Local.ts
  • packages/nocodb/src/services/attachments.service.ts
Additional context used
Biome
packages/nocodb/src/plugins/s3/S3.ts

[error] 59-59: The catch clause that only rethrows the original error is redundant.

These unnecessary catch clauses can be confusing. It is recommended to remove them.

(lint/complexity/noUselessCatch)

Additional comments not posted (13)
packages/nc-gui/components/cell/attachment/Preview/Image.vue (2)

Line range hint 1-9:
LGTM!

The <script setup> section is well-structured, correctly defining the props and setting up error handling.


16-29: LGTM!

The <template> section effectively handles image loading errors and provides a fallback component. The usage of v-if and @error is appropriate.

packages/nocodb/src/plugins/vultr/Vultr.ts (2)

50-53: LGTM!

The fileCreateByUrl method correctly handles file creation by URL, including proper error handling and response processing.


19-22: Ensure proper return type consistency.

The fileCreate method returns a structured response. Update the return type for consistency.

-  async fileCreate(key: string, file: XcFile): Promise<any> {
+  async fileCreate(key: string, file: XcFile): Promise<{ url: string; data: any; }> {

Likely invalid or redundant comment.

packages/nocodb/src/plugins/upcloud/UpoCloud.ts (1)

50-53: LGTM!

The fileCreateByUrl method correctly handles file creation by URL, including proper error handling and response processing.

packages/nocodb/src/plugins/ovhCloud/OvhCloud.ts (1)

19-22: LGTM!

The refactoring to use fileCreateByStream improves code reuse and readability.

packages/nocodb/src/plugins/backblaze/Backblaze.ts (1)

19-22: LGTM!

The refactoring to use fileCreateByStream improves code reuse and readability.

packages/nocodb/src/plugins/s3/S3.ts (1)

32-34: LGTM!

The refactoring to use fileCreateByStream improves code reuse and readability.

packages/nocodb/src/controllers/attachments.controller.ts (1)

2-2: Import statement for fs is correct.

The import statement for fs is necessary for the subsequent file operations.

packages/nocodb/src/services/public-datas.service.ts (4)

8-8: Import statement for sharp is correct.

The import statement for sharp is necessary for image processing.


22-24: Import statements for job-related modules are correct.

The import statements for IJobsService, JobTypes, and RootScopes are necessary for job management.


34-39: Constructor for injecting JobsService is correct.

The constructor is correctly implemented to inject the JobsService for job management.


544-550: Job addition for thumbnail generation is correct.

The job addition for thumbnail generation using JobsService is correctly implemented to enhance image handling.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jul 26, 2024
@dstala dstala merged commit cb3a9cf into develop Jul 26, 2024
@dstala dstala deleted the nc-thumbnail-processor branch July 26, 2024 04:44
@coderabbitai coderabbitai bot mentioned this pull request Sep 24, 2024
1 task
@coderabbitai coderabbitai bot mentioned this pull request Nov 4, 2024
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:XXL This PR changes 1000+ lines, ignoring generated files. 🔦 Type: Feature New functionality is requested.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🔦 Feature: Thumbnail generator for image uploaded

3 participants