pytest-html icon indicating copy to clipboard operation
pytest-html copied to clipboard

pytest html file in a Chinese path, there ate some error

Open Mutiantian opened this issue 1 year ago • 2 comments
trafficstars

pytest html file in a Chinese path, there ate some error

in pure english path: 企业微信截图_17066134131866

path has some Chinese 企业微信截图_17066130942020

Mutiantian avatar Jan 30 '24 11:01 Mutiantian

const hideCategory = (categoryToHide) => {
    const url = new URL(window.location.href)
    const visibleParams = new URLSearchParams(url.search).get('visible')
    const currentVisible = visibleParams ? visibleParams.split(',') : [...possibleFilters]
    const settings = [...new Set(currentVisible)].filter((f) => f !== categoryToHide).join(',')

    url.searchParams.set('visible', settings)
    try {
    window.history.pushState(null, null, url);
    } catch (error) {
        console.error("Failed to push state to history: " + error);
    }

}
const showCategory = (categoryToShow) => {
    if (typeof window === 'undefined') {
        return
    }
    const url = new URL(window.location.href)
    const currentVisible = new URLSearchParams(url.search).get('visible')?.split(',').filter(Boolean) ||
        [...possibleFilters]
    const settings = [...new Set([categoryToShow, ...currentVisible])]
    const noFilter = possibleFilters.length === settings.length || !settings.length

    noFilter ? url.searchParams.delete('visible') : url.searchParams.set('visible', settings.join(','))
    try {
    window.history.pushState(null, null, url);
    } catch (error) {
        console.error("Failed to push state to history: " + error);
    }
}
const setSort = (type) => {
    const url = new URL(window.location.href)
    url.searchParams.set('sort', type)
    try {
    window.history.pushState(null, null, url);
    } catch (error) {
        console.error("Failed to push state to history: " + error);
    }
}

here should add some try catch

Mutiantian avatar Jan 30 '24 11:01 Mutiantian

The error manifests itself in any non-ASCII path. I have a download folder that has the localized name "Stahování" (Czech localization) and I get the same error message in the browser console (Chromium, Firefox). Moving the report to a path that contains only ASCII characters fixes the report.

ondrasouk avatar Jun 11 '24 14:06 ondrasouk