refined-github/refined-github

`release-download-count`: GHES 3.18.7: Expected node matching /^\d+(\.\d+)? \w{2,5}$/, found "sha256:<snip>"

Closed

#9,210 创建于 2026年4月17日

在 GitHub 查看
 (2 评论) (1 反应) (0 负责人)TypeScript (22,918 star) (1,423 fork)batch import
bugenterprisehelp wanted

描述

Description

release-download-count is broken on GHES 3.18.7:

console shows: Expected node matching /^\d+(\.\d+)? \w{2,5}$/, found "sha256:<snip>"

I compared the DOMs of github.com and GHES:

<li data-view-component="true" class="Box-row d-flex flex-column flex-md-row">
    <div style="overflow: hidden;" data-view-component="true" class="d-flex flex-justify-start flex-items-center col-12 col-lg-6">
        <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-package color-fg-muted mr-2 tmp-mr-2">
            <path d="m8.878.392 5.25 3.045c.54.314.872.89.872 1.514v6.098a1.75 1.75 0 0 1-.872 1.514l-5.25 3.045a1.75 1.75 0 0 1-1.756 0l-5.25-3.045A1.75 1.75 0 0 1 1 11.049V4.951c0-.624.332-1.201.872-1.514L7.122.392a1.75 1.75 0 0 1 1.756 0ZM7.875 1.69l-4.63 2.685L8 7.133l4.755-2.758-4.63-2.685a.248.248 0 0 0-.25 0ZM2.5 5.677v5.372c0 .09.047.171.125.216l4.625 2.683V8.432Zm6.25 8.271 4.625-2.683a.25.25 0 0 0 .125-.216V5.677L8.75 8.432Z"/>
        </svg>
        <a href="/refined-github/sandbox/releases/download/v1.0.0/changelog.txt" rel="nofollow" data-turbo="false" data-view-component="true" class="Truncate">
            <span data-view-component="true" class="Truncate-text text-bold">changelog.txt</span>
            <span data-view-component="true" class="Truncate-text"/>
        </a>
    </div>
    <div data-view-component="true" class="d-flex flex-auto flex-justify-end flex-items-center col-md-6 ml-3 tmp-ml-3 ml-md-0 tmp-ml-md-0 mt-1 tmp-mt-1 mt-md-0 tmp-mt-md-0 pl-1 tmp-pl-1 pl-md-0 tmp-pl-md-0">
        <div style="overflow: hidden;" data-view-component="true" class="d-flex d-sm-none d-md-none d-lg-flex flex-items-center flex-justify-end flex-1">
            <span style="min-width: 0; max-width: 250px" data-view-component="true" class="Truncate text-mono text-small color-fg-muted">
                <span data-view-component="true" class="Truncate-text">sha256:9a271f2a916b0b6ee6cecb2426f0b3206ef074578be55d9bc94f6f3fe3ab86aa</span>
            </span>
            <span data-view-component="true">
                <clipboard-copy id="clipboard-button-sha256:9a271f2a916b0b6ee6cecb2426f0b3206ef074578be55d9bc94f6f3fe3ab86aa" aria-label="Copy to clipboard digest for changelog.txt" type="button" value="sha256:9a271f2a916b0b6ee6cecb2426f0b3206ef074578be55d9bc94f6f3fe3ab86aa" data-view-component="true" class="Button--invisible Button--small Button Button--invisible-noVisuals color-fg-muted" tabindex="0" role="button">
                    <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-copy">
                        <path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"/>
                        <path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"/>
                    </svg>
                    <svg style="display: none;" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-check color-fg-success">
                        <path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"/>
                    </svg>
                </clipboard-copy>
                <div aria-live="polite" aria-atomic="true" class="sr-only" data-clipboard-copy-feedback=""/>
            </span>
        </div>
        <span style="white-space: nowrap; min-width: clamp(50px, 15vw, 75px);" data-view-component="true" class="color-fg-muted text-right flex-shrink-0 flex-grow-0 ml-2 tmp-ml-2 ml-sm-3 tmp-ml-sm-3 ml-md-4 tmp-ml-md-4">2 Bytes</span>
        <span style="white-space: nowrap; min-width: clamp(75px, 15vw, 100px);" data-view-component="true" class="color-fg-muted text-right flex-shrink-0 flex-grow-0 ml-2 tmp-ml-2 ml-sm-3 tmp-ml-sm-3 ml-md-4 tmp-ml-md-4">
            <relative-time datetime="2025-08-06T04:15:29Z" class="no-wrap" prefix="" title="Aug 6, 2025, 6:15 AM GMT+2">
                <template shadowrootmode="open">Aug 6, 2025</template>2025-08-06T04:15:29Z</relative-time>
        </span>
    </div>
</li>
<li data-view-component="true" class="Box-row d-flex flex-column flex-md-row">
    <div data-view-component="true" class="d-flex flex-justify-start col-12 col-lg-6">
        <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-package color-fg-muted">
            <path d="m8.878.392 5.25 3.045c.54.314.872.89.872 1.514v6.098a1.75 1.75 0 0 1-.872 1.514l-5.25 3.045a1.75 1.75 0 0 1-1.756 0l-5.25-3.045A1.75 1.75 0 0 1 1 11.049V4.951c0-.624.332-1.201.872-1.514L7.122.392a1.75 1.75 0 0 1 1.756 0ZM7.875 1.69l-4.63 2.685L8 7.133l4.755-2.758-4.63-2.685a.248.248 0 0 0-.25 0ZM2.5 5.677v5.372c0 .09.047.171.125.216l4.625 2.683V8.432Zm6.25 8.271 4.625-2.683a.25.25 0 0 0 .125-.216V5.677L8.75 8.432Z"/>
        </svg>
        <a href="/org/repo/releases/download/tag1/file.dat" rel="nofollow" data-turbo="false" data-view-component="true" class="Truncate">
            <span data-view-component="true" class="Truncate-text text-bold">file.dat</span>
            <span data-view-component="true" class="Truncate-text"/>
        </a>
    </div>
    <div data-view-component="true" class="d-flex flex-auto flex-justify-end flex-items-center col-md-4 ml-3 ml-md-0 mt-1 mt-md-0 pl-1 pl-md-0">
        <span style="white-space: nowrap; max-width: 250px; min-width: 150px" data-view-component="true" class="css-truncate css-truncate-target text-mono text-small color-fg-muted text-sm-left flex-auto ml-md-3 mr-1 flex-grow-0">
            sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
        </span>
        <span data-view-component="true">
            <clipboard-copy aria-label="copy to clipboard digest for file.dat" data-copy-feedback="Copied!" data-tooltip-direction="ne" role="button" value="sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" data-view-component="true" class="CopyBlock flex-auto" tabindex="0">
                <svg style="display: inline;" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-copy">
                    <path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"/>
                    <path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"/>
                </svg>
            </clipboard-copy>
            <div aria-live="polite" aria-atomic="true" class="sr-only" data-clipboard-copy-feedback=""/>
        </span>
        <span style="white-space: nowrap; min-width: 75px" data-view-component="true" class="color-fg-muted text-right flex-shrink-0 flex-grow-0 ml-4">86 MB</span>
        <span style="white-space: nowrap; min-width: 100px" data-view-component="true" class="color-fg-muted text-right flex-shrink-0 flex-grow-0 ml-4">
            <relative-time datetime="2026-04-17T02:10:44Z" class="no-wrap" prefix="" title="Apr 17, 2026, 4:10 AM GMT+2">
                <template shadowrootmode="open">6 hours ago</template>2026-04-17T02:10:44Z</relative-time>
        </span>
    </div>
</li>

Note that GHES uses toplevel <span>s for the SHA column and the download button, while github.com nests them in another <div>.

Hence, the selector https://github.com/refined-github/refined-github/blob/3e9a88d05c25f58a6f5cee6dfa48f51ed43a4d13/source/features/release-download-count.tsx#L55 finds the wrong <span>.

How to replicate the issue + URL

No public URL as this is for GHES.

Extension version

26.4.4

Browser(s) used

Firefox

Token ⚠️

  • I set a token in the options page. I understand that some features require a token to work.

贡献者指南