Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Disk Cache template replacement to replace all instances of variable key #330

Merged
merged 1 commit into from
Jan 26, 2024

Conversation

CrazyLegumes
Copy link
Contributor

Current template implementation in cache_disk.c only replaces the first instance of a templated variable while there may exist more instances of it within the setting. For example, something like:
<template>/tmp/template-test/{tileset}/{grid}/{dim}/{z}/{x}/{z}_{y}.{ext}</template>
would get renamed to:
<template>/tmp/template-test/myTileset/myGrid/someDim/4/1/{z}_0.png</template>
rather than what one might expect:
<template>/tmp/template-test/myTileset/myGrid/someDim/4/1/4_0.png</template>

Is there currently a reason why only the first instance of a key is replaced even though the implementation to replace all keys in a given string already exists within source?
I couldn't find any documentation or references in the example mapcache.xml file that would suggest that only one instance of the key is allowed/

- Updated disk cache templates to replace all instances of discovered variables instead of just the first instance.
@jmckenna
Copy link
Member

@jratike80 @marisn can you give a review?

Copy link
Contributor

@marisn marisn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable.

@jmckenna
Copy link
Member

thanks @CrazyLegumes ! (and thanks for the quick review by @marisn & @tbonfort )

@jmckenna jmckenna merged commit 7104eca into MapServer:main Jan 26, 2024
7 checks passed
@jmckenna jmckenna added this to the 1.14.1 release milestone Jan 26, 2024
@CrazyLegumes CrazyLegumes deleted the disk-caching-template-all branch January 26, 2024 19:47
jmckenna pushed a commit that referenced this pull request Aug 2, 2024
- Updated disk cache templates to replace all instances of discovered variables instead of just the first instance.
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants