-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Differentiate postman folder from request when at collection root #3912
Conversation
… info being identical to request info
pkg/sources/postman/postman.go
Outdated
@@ -350,17 +350,23 @@ func (s *Source) scanItem(ctx context.Context, chunksChan chan *sources.Chunk, c | |||
if item.UID != "" { | |||
metadata.FullID = item.UID | |||
metadata.Link = LINK_BASE_URL + FOLDER_TYPE + "/" + metadata.FullID | |||
metadata.FolderID = item.UID |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is to handle the cases where the item that is going to be scanned is a folder itself that contains an auth or script. In that case, we want the FolderID to be of the target instead of the parent.
…unnecessary code and moved event call to after the type check
} | ||
|
||
metadata.FolderID = item.UID |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
per convo, i think a comment here explaining all this parent folder ID business would be helpful
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks great, thanks!
Description:
When Postman items (mainly requests) did not have a parent folder and were at the root of a collection, the folder id/name would be the same as the request id/name. This change helps to keep track of the parent folder through the recursive calls and gives the folder ID of the last folder that the call went through.
Checklist:
make test-community
)?make lint
this requires golangci-lint)?