<div dir="ltr"><div><p style="margin-right:0px;margin-bottom:15px;margin-left:0px;color:rgb(51,51,51);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:12.800000190734863px;line-height:17.600000381469727px;background-color:rgb(251,251,251);margin-top:0px!important">
This patch removes several special characters <span style="font-size:12.800000190734863px;line-height:17.600000381469727px">while attempting to preserve as much meaning in the filename as possible. These changes are made to the KeepassX title before it is used as a file password store filename:</span></p>
<ul style="padding:0px 0px 0px 30px;margin:15px 0px;color:rgb(51,51,51);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:12.800000190734863px;line-height:17.600000381469727px;background-color:rgb(251,251,251)">
<li>Spaces between words in file names are replaced with camelCasing.</li><li>The characters \ | ( ) are each replaced with a hyphen.</li><li>Trailing hypens are removed.</li><li>@ is replaced with "At"</li><li>
' is removed</li></ul></div><div>---</div><div> contrib/keepassx2pass.py | 25 ++++++++++++++++++++++++-</div><div> 1 file changed, 24 insertions(+), 1 deletion(-)</div><div><br></div><div>diff --git a/contrib/keepassx2pass.py b/contrib/keepassx2pass.py</div>
<div>index 1804e33..dc4b1e5 100755</div><div>--- a/contrib/keepassx2pass.py</div><div>+++ b/contrib/keepassx2pass.py</div><div>@@ -5,13 +5,36 @@</div><div> # This file is licensed under the GPLv2+. Please see COPYING for more information.</div>
<div> </div><div> import sys</div><div>+import re</div><div> </div><div> from subprocess import Popen, PIPE</div><div> from xml.etree import ElementTree</div><div> </div><div>+def space_to_camelcase(value):</div><div>+    output = ""</div>
<div>+    first_word_passed = False</div><div>+    for word in value.split(" "):</div><div>+        if not word:</div><div>+            output += "_"</div><div>+            continue</div><div>+        if first_word_passed:</div>
<div>+            output += word.capitalize()</div><div>+        else:</div><div>+            output += word.lower()</div><div>+        first_word_passed = True</div><div>+    return output</div><div>+</div><div>+def cleanTitle(title):</div>
<div>+    # make the title more command line friendly</div><div>+    title = re.sub("(\\|\||\(|\))", "-", title)</div><div>+    title = re.sub("-$", "", title)</div><div>+    title = re.sub("\@", "At", title)</div>
<div>+    title = re.sub("'", "", title)</div><div>+    return title</div><div>+</div><div> def path_for(element, path=''):</div><div>     """ Generate path name from elements title and current path """</div>
<div>-    title = element.find('title').text.replace("/", "|")</div><div>+    title = cleanTitle(space_to_camelcase(element.find('title').text))</div><div>     return '/'.join([path, title])</div>
<div> </div><div> def password_data(element):</div><div>-- </div><div>1.8.0</div><div><br></div>-- <br>Philip Chase * 352-575-0705 * Gainesville, FL
<div><br></div></div>