diff --git a/xroot_plugins/XrdCtaFile.cpp b/xroot_plugins/XrdCtaFile.cpp
index 2ff10582d2098ac897925ad4cc226c1ee6e24f3e..7bab96dc11c5f0fd6cc40546c19408e8fbe258d8 100644
--- a/xroot_plugins/XrdCtaFile.cpp
+++ b/xroot_plugins/XrdCtaFile.cpp
@@ -399,8 +399,9 @@ std::string XrdCtaFile::getOption(const std::string& optionShortName, const std:
       }
       auto it_next=it+1;
       if(it_next!=m_requestTokens.cend()) {
-        if(!encoded) return *it_next;
-        else return decode(*it_next);
+        std::string value = *it_next;
+        if(!encoded) return value;
+        else return decode(value.erase(0,7)); //erasing the first 7 characters "base64:" and decoding the rest
       }
       else {
         return "";