Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api): File info API #2496

Merged
merged 1 commit into from
Jul 26, 2023
Merged

Conversation

soham4abc
Copy link
Contributor

@soham4abc soham4abc commented Jun 26, 2023

Description

API endpoint to get info for a file

How to test

Send a get request to /file/upload/{UploadId}/item/{ItemId}/info

Screenshots

image

closes #2493

@shaheemazmalmmd @GMishx

@GMishx GMishx added needs code review needs test GSOC-23 Label to tag pull request which are part of the GSOC 2023 labels Jun 28, 2023
@github-actions github-actions bot added the has merge conflicts PR to be rebased label Jul 5, 2023
@github-actions
Copy link

github-actions bot commented Jul 5, 2023

This pull request has conflicts, please rebase with master to resolve those before we can evaluate the pull request.

Copy link
Member

@GMishx GMishx left a comment

Choose a reason for hiding this comment

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

Seeing the screenshot attached, would recommend following changes:

  1. view_info:
    1. can extend the Hash model object as it already contains the checksums and file size.
    2. No need of different size calculations, the size in bytes stored in Hash can be used to calculate them.
    3. Change filePfileId to pfileId.
  2. meta_info:
    1. Remove file from the beginning of keys.
    2. I believe fileInfo and scanossInfo as booleans? Please check if so and translate 1 => true, 0 => false.

Try uploading this small deb file and run the package analysis agent on it to get more info on the page.
At the same time, try running the scanoss agent on FOSSology or atarashi to get some match info in Info page.

https://ftp.debian.org/debian/pool/main/l/lsb/lsb-release_11.1.0_all.deb

src/www/ui/api/Controllers/FileInfoController.php Outdated Show resolved Hide resolved
src/www/ui/api/Controllers/FileInfoController.php Outdated Show resolved Hide resolved
src/www/ui/api/Controllers/FileInfoController.php Outdated Show resolved Hide resolved
src/www/ui/api/Controllers/FileInfoController.php Outdated Show resolved Hide resolved
src/www/ui/api/documentation/openapi.yaml Outdated Show resolved Hide resolved
@GMishx
Copy link
Member

GMishx commented Jul 24, 2023

Tested, working as expected.

@GMishx GMishx removed the needs test label Jul 24, 2023
@soham4abc soham4abc force-pushed the api/getfileinfo branch 2 times, most recently from 4ed749a to c31c083 Compare July 24, 2023 06:51
@github-actions github-actions bot removed the has merge conflicts PR to be rebased label Jul 24, 2023
@soham4abc
Copy link
Contributor Author

Response for the provided .deb file

Please do have a look at it and we can discuss further changes required!
image

@soham4abc soham4abc requested a review from GMishx July 24, 2023 06:58
src/www/ui/api/Controllers/FileInfoController.php Outdated Show resolved Hide resolved
src/www/ui/api/index.php Outdated Show resolved Hide resolved
@GMishx
Copy link
Member

GMishx commented Jul 26, 2023

Response for the provided .deb file

Please do have a look at it and we can discuss further changes required! ![image]

pkgagent does not seem to work correctly now. Let us not bother much about its output as people rarely use it. We can fix it later.

@soham4abc
Copy link
Contributor Author

Response for the provided .deb file
Please do have a look at it and we can discuss further changes required! ![image]

pkgagent does not seem to work correctly now. Let us not bother much about its output as people rarely use it. We can fix it later.

Sure!!

Copy link
Member

@GMishx GMishx left a comment

Choose a reason for hiding this comment

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

Changes looks good.

@GMishx GMishx merged commit 9ca5075 into fossology:master Jul 26, 2023
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GSOC-23 Label to tag pull request which are part of the GSOC 2023 ready
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Info
2 participants