Changeset 19211 in josm for trunk


Ignore:
Timestamp:
2024-09-06T09:24:24+02:00 (2 months ago)
Author:
stoecker
Message:

make cache file length configurable, ensure it's below 140 - encrypted ext4 seems to have a 143 byte limit, see #23850

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/CachedFile.java

    r19194 r19211  
    485485
    486486        String a = urlStr.replaceAll("[^A-Za-z0-9_.-]", "_");
    487         if (a.length() > 120) {
    488             a = a.substring(0, 100) + "_" + Utils.md5Hex(urlStr);
     487        /* size 11: prefix mirror_ and suffix .tmp */
     488        Integer maxFileLength = Config.getPref().getInt("cache.filename.maxlength", 140)-11;
     489        if (a.length() > maxFileLength) {
     490            a = a.substring(0, maxFileLength-33) + "_" + Utils.md5Hex(urlStr);
    489491        }
    490492        String localPath = "mirror_" + a;
Note: See TracChangeset for help on using the changeset viewer.