Skip to content

Conversation

@noomorph
Copy link
Contributor

Context

In our private allure2 fork, we use the source field of attachments not only for file paths but also to support data:, http:, https:, and file: protocols. Basically, remote-hosted attachment files (or JSON-only allure-results with no binary ballast).

While this works quite well, an optional size property would be extremely helpful for remote attachments — it would eliminate the need for HTTP roundtrips using HEAD requests just to retrieve Content-Length when generating HTML reports.

I wonder, can we find common ground here and consider making this part of the standard?

Checklist

@github-actions github-actions bot added the theme:api Javascript API related issue label Jun 20, 2025
@noomorph
Copy link
Contributor Author

noomorph commented Jun 20, 2025

For more context.

I meant the extra roundtrips here: https://github.com/allure-framework/allure2/blob/main/allure-generator/src/main/java/io/qameta/allure/DefaultResultsVisitor.java

    @Override
    public Attachment visitAttachmentLink(final URL attachmentLink) {
        final RandomUidContext context = configuration.requireContext(RandomUidContext.class);
        return attachmentLinks.computeIfAbsent(attachmentLink.toString(), file -> {
            final String uid = context.getValue().get();
            final String fileName = attachmentLink.getFile();
            final String source = attachmentLink.toString();
            final Long size = new UrlSizeChecker().getContentSize(attachmentLink);
            return new Attachment()
                    .setUid(uid)
                    .setName(fileName)
                    .setSource(source)
                    .setType(WILDCARD)
                    .setSize(size);
        });
    }

If you are interested in backporting size to allure2 Java generator, I could provide the cherry-pick from the fork.

@epszaw
Copy link
Member

epszaw commented Jul 1, 2025

I don't see any concern there. Until the parameter is optional, the user decides, which size value should be used in the attachment. @delatrie what do you think?

@noomorph
Copy link
Contributor Author

noomorph commented Jul 9, 2025

Well, I have not looked for that in allure3, but if you want some basic implementation there too, I might look into it.

@baev baev added the type:improvement Improvement or request label Jul 30, 2025
@baev baev merged commit 8d31175 into allure-framework:main Sep 10, 2025
10 of 11 checks passed
@noomorph noomorph deleted the patch-1 branch September 10, 2025 10:30
@noomorph
Copy link
Contributor Author

noomorph commented Sep 10, 2025

@baev, thanks much! 🙏 Could you look also into: allure-framework/allure-java#1182 ? They are related.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

theme:api Javascript API related issue type:improvement Improvement or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants