pytest-dev/pytest-html

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

Mutiantian opened this issue · 2 comments

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

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

path has some Chinese
企业微信截图_17066130942020

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

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.