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

incompatibility with farming technique . single line fix attached #7

Open
schplurtz opened this issue Apr 3, 2013 · 2 comments · May be fixed by #20
Open

incompatibility with farming technique . single line fix attached #7

schplurtz opened this issue Apr 3, 2013 · 2 comments · May be fixed by #20

Comments

@schplurtz
Copy link

Hi,

This plugins in not compatible with farming techniques described in https://www.dokuwiki.org/farms#b_htaccess_based_setup . This technique adds an HTTP GET parametre.

When the doku text is parsed, a cachefilename is computed based on the md5 sum of the graph parametres, and the img URL that contains the parametres is created. When the browser later GETs the image, the farming rewriting rules add the animal=foo parametre to the URL parametre list. Graphviz plugin then computes the md5 out of the parametre list, which just happens to be different from the initial parametre list. Cache file has a different name, is not found; user gets the error image :-(.

This simple patch filters out any unexpected GET parameters in the _imgfile function, making the plugin compatible with the farming technique.

diff -Naur syntax.php.orig syntax.php 
--- syntax.php.orig 2013-04-03 05:41:13.111977071 +0200
+++ syntax.php  2013-04-03 06:08:48.652007895 +0200
@@ -119,6 +119,8 @@
      * Return path to the rendered image on our local system
      */
     function _imgfile($data){
+   // filter out unwanted GET parametres
+   $data=array_intersect_key( $data, array( 'width' => 1, 'height' => 1, 'layout' => 1, 'align' => 1, 'version' => 1, 'md5' => 1 ));
         $cache  = $this->_cachename($data,'png');

         // create the file if needed

/Schplurtz

@atisne
Copy link

atisne commented Sep 24, 2014

As reported in https://www.dokuwiki.org/plugin:graphviz#compatibility, the following patch seems also to work:

In syntax.php
function _cachename($data,$ext){
unset($data['width']);
unset($data['height']);
unset($data['align']);
+++ unset($data['animal']);
return getcachename(join('x',array_values($data)),'.graphviz.'.$ext);
}

Don't know which is the best.

@schplurtz
Copy link
Author

I did not test anything, but, in june 2022, the animal parameter has been removed from the query string in both DW core and the farmer plugin. So for anyone running DW release Igor or newer, or using a recent version of the farmer plugin, there is no problem anymore.

See. discussion in dokuwiki/dokuwiki#3551
.
This bug report can be 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 a pull request may close this issue.

2 participants