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

Error when running scan_codebase on npm package using a download url source #1521

Open
JonoYang opened this issue Jan 8, 2025 · 1 comment · May be fixed by aboutcode-org/scancode-toolkit#4079
Labels
bug Something isn't working

Comments

@JonoYang
Copy link
Member

JonoYang commented Jan 8, 2025

When running the scan_codebase pipeline on an npm package input from a download url source (e.g. https://github.com/gravitational/teleport/archive/refs/tags/v17.1.4.tar.gz), the following exception occurs:

'str' object has no attribute 'location'

Traceback:
  File "/opt/scancodeio/aboutcode/pipeline/__init__.py", line 199, in execute
    step(self)
  File "/opt/scancodeio/scanpipe/pipelines/scan_codebase.py", line 63, in scan_for_application_packages
    scancode.scan_for_application_packages(self.project, progress_logger=self.log)
  File "/opt/scancodeio/scanpipe/pipes/scancode.py", line 409, in scan_for_application_packages
    assemble_packages(project=project)
  File "/opt/scancodeio/scanpipe/pipes/scancode.py", line 466, in assemble_packages
    for item in items:
                ^^^^^
  File "/opt/scancodeio/.venv/lib/python3.12/site-packages/packagedcode/npm.py", line 139, in assemble
    workspace_members = cls.get_workspace_members(
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/scancodeio/.venv/lib/python3.12/site-packages/packagedcode/npm.py", line 444, in get_workspace_members
    if NpmPackageJsonHandler.is_datafile(resource.location) and fnmatch.fnmatch(

Using the scan_single_package pipeline works just fine.

@JonoYang JonoYang added the bug Something isn't working label Jan 8, 2025
@JonoYang
Copy link
Member Author

JonoYang commented Jan 8, 2025

I think the issue is around here (https://github.com/aboutcode-org/scancode-toolkit/blob/develop/src/packagedcode/npm.py#L447) where the we should get the Resource for workspace_root_path and iterate on Resources. Right now, it is iterating through the string workspace_root_path.

AyanSinhaMahapatra added a commit to aboutcode-org/scancode-toolkit that referenced this issue Jan 8, 2025
Reference: aboutcode-org/scancode.io#1521
Reported-by: @JonoYang
Signed-off-by: Ayan Sinha Mahapatra <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant