Page MenuHomeSoftware Heritage

browse/utils: Ensure to guess language from filename and not its path
ClosedPublic

Authored by anlambert on Mon, Jan 10, 6:30 PM.

Details

Summary

A filename must be provided as parameter to the get_hljs_language_from_filename
function and not a path.

This fixes some code highlighting issue when a filename who has a language
associated is not in the root directory of the browsed filesystem.

See for instance that CMakeLists.txt file that should have been highlighted as cmake.

Diff Detail

Repository
rDWAPPS Web applications
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Build is green

Patch application report for D6904 (id=25036)

Rebasing onto 835a860126...

Current branch diff-target is up to date.
Changes applied before test
commit 4f7f6281ef8f79e6270226b6b1ea11605d651885
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Mon Jan 10 18:23:19 2022 +0100

    browse/utils: Ensure to guess language from filename and not its path
    
    A filename must be provided as parameter to the get_hljs_language_from_filename
    function and not a path.
    
    This fixes some code highlighting issue when a filename who has a language
    associated is not in the root directory of the browsed filesystem.

See https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1283/ for more details.

This revision is now accepted and ready to land.Tue, Jan 11, 10:08 AM