fix: URL in post text is truncated when using --long option #30
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem Description
Fixes #16
When executing
ssky get --longon posts containing URLs created from the Bluesky GUI, the URLs in the post text are displayed in a truncated state.Root Cause
The issue was caused by the
PostDataList.Item.long()method displaying the rawpost.record.textwhich contains truncated URLs, while the complete URL information is stored inpost.record.facetsbut was not being processed.Solution
Added a new method
_process_urls_from_facets()that:facetsinformationChanges Made
New Method:
_process_urls_from_facets()Modified Methods:
text_only(): Now processes URLs from facetslong(): Now processes URLs from facetssimple_json(): Now processes URLs from facetsTesting
Tested with the sample URI from issue #16:
ssky get "at://did:plc:g5olzasrsnnfbz3vabzhgqlh/app.bsky.feed.post/3loaq77q5fk2u::bafyreig2sba4eftvc6cqunmzhwlxpwwi6ps7bwtbq3wxqmwkemyp2cdfs4" -LBefore:
After:
Impact
--longformat--textformat--simple-jsonformatBackward Compatibility
This change is fully backward compatible and only improves the display of URLs without affecting any existing functionality.