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

CodebaseResourceDetailsView Page not found for scan_codebase pipeline results #147

Closed
tdruez opened this issue Apr 9, 2021 · 4 comments
Closed
Assignees
Milestone

Comments

@tdruez
Copy link
Contributor

tdruez commented Apr 9, 2021

Note that this is not an issue for the docker and rootfs pipelines.
Likely related to the codebase/ prefix in the resources path.

@tdruez tdruez self-assigned this Apr 9, 2021
@tdruez tdruez added this to the 2021-05 milestone Apr 9, 2021
@AvishrantsSh
Copy link
Collaborator

I have been working on this, and yes, it is due to the codebase/ prefix. The prefix codebase/ appears twice in the url (line 2).

Screenshot from 2021-04-09 20-13-16

@AvishrantsSh
Copy link
Collaborator

@tdruez, I have been studying this bug for a while now and here are the possible solutions

  1. In scanpipe.py, the results are stored in CodebaseResource model with path = resource_data.pop("path"). This path already contains codebase prefix in it. So one solution is to remove the prefix from here.
  2. The other solution is to rewrite codebase_path property and remove codebase prefix from it.

@tdruez
Copy link
Contributor Author

tdruez commented Apr 28, 2021

Hi @AvishrantsSh thanks for your input on this one.

In scanpipe.py, the results are stored in CodebaseResource model with path = resource_data.pop("path"). This path already contains codebase prefix in it. So one solution is to remove the prefix from here.

Yes that would work, but we also need to remove the prefix in other places such as in create_discovered_packages as the codebase resource is retrieve in the db using the path.

The other solution is to rewrite codebase_path property and remove codebase prefix from it.

That would work as well, the problem with that approach is that we would keep storing the "codebase/" prefix for all codebase resource in the database to then clean it each time. It would be better to not store it in the first place.


Both of your solutions would work fine as workaround but a better approach would be to enhance the VirtualCodebase to offer an API that would return paths without the root. VirtualCodebase.walk(skip_root=True) is available to not include the root as a resource, but we should add a way to not include the root in all the returned paths.

I'll look at it with @pombredanne on the toolkit side.

tdruez added a commit that referenced this issue Apr 28, 2021
Signed-off-by: Thomas Druez <tdruez@nexb.com>
@tdruez
Copy link
Contributor Author

tdruez commented Apr 29, 2021

@AvishrantsSh see the fix at 4d46a38

@tdruez tdruez closed this as completed Apr 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants