Skip to content

feat: Copy B2 CLI URL #17108

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

feat: Copy B2 CLI URL #17108

wants to merge 1 commit into from

Conversation

dwahdany
Copy link

closes #17107
tests are missing

@dwahdany dwahdany requested a review from a team as a code owner May 16, 2025 13:25
@CLAassistant
Copy link

CLAassistant commented May 16, 2025

CLA assistant check
All committers have signed the CLA.

@dwahdany
Copy link
Author

Adds the abiliy to copy CLI URLs to both files and directories
image
image

Copy link
Contributor

@dkocher dkocher left a comment

Choose a reason for hiding this comment

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

Please add a test case for the new URL format for files and directories in B2UrlProviderTest.

else {
String key;
if(file.isDirectory()) {
key = PathRelativizer.relativize(container.getAbsolute(), file.getAbsolute());
Copy link
Contributor

Choose a reason for hiding this comment

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

Use B2PathContainerService#getKey and strip the end .bzEmpty (B2PathContainerService.PLACEHOLDER)

URIEncoder.encode(containerService.getKey(file)));
list.add(new DescriptiveUrl(download, DescriptiveUrl.Type.http,
MessageFormat.format(LocaleFactory.localizedString("{0} URL"), Scheme.https.name().toUpperCase(Locale.ROOT))));
if(file.isFile() || file.isDirectory()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Move check for file type inside scope of handled types.

private final B2Session session;

public B2UrlProvider(final B2Session session) {
this.session = session;
this.containerService = session.getFeature(PathContainerService.class);
Copy link
Contributor

Choose a reason for hiding this comment

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

Revert this change as the pattern instantiating B2PathContainerService is present in all other features.

if(types.contains(DescriptiveUrl.Type.provider)) {
final Path container = containerService.getContainer(file);
if(!file.isRoot()) {
String cliUrl;
Copy link
Contributor

Choose a reason for hiding this comment

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

Assign final.

@dkocher dkocher added the b2 Backblaze B2 Protocol Implementation label May 19, 2025
@dkocher dkocher added this to the 9.2 milestone May 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
b2 Backblaze B2 Protocol Implementation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Copy B2 CLI URL
3 participants