Merge pull request #1136 from dragtheron/patch-1

Encode password to allow special characters
This commit is contained in:
Peter Bieringer 2024-03-09 07:17:24 +01:00 committed by GitHub
commit b4d7eb5f04
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -119,7 +119,7 @@ function Collection(href, type, displayname, description, color) {
*/ */
function get_principal(user, password, callback) { function get_principal(user, password, callback) {
let request = new XMLHttpRequest(); let request = new XMLHttpRequest();
request.open("PROPFIND", SERVER + ROOT_PATH, true, user, password); request.open("PROPFIND", SERVER + ROOT_PATH, true, user, encodeURIComponent(password));
request.onreadystatechange = function() { request.onreadystatechange = function() {
if (request.readyState !== 4) { if (request.readyState !== 4) {
return; return;
@ -162,7 +162,7 @@ function get_principal(user, password, callback) {
*/ */
function get_collections(user, password, collection, callback) { function get_collections(user, password, collection, callback) {
let request = new XMLHttpRequest(); let request = new XMLHttpRequest();
request.open("PROPFIND", SERVER + collection.href, true, user, password); request.open("PROPFIND", SERVER + collection.href, true, user, encodeURIComponent(password));
request.setRequestHeader("depth", "1"); request.setRequestHeader("depth", "1");
request.onreadystatechange = function() { request.onreadystatechange = function() {
if (request.readyState !== 4) { if (request.readyState !== 4) {
@ -263,7 +263,7 @@ function get_collections(user, password, collection, callback) {
*/ */
function upload_collection(user, password, collection_href, file, callback) { function upload_collection(user, password, collection_href, file, callback) {
let request = new XMLHttpRequest(); let request = new XMLHttpRequest();
request.open("PUT", SERVER + collection_href, true, user, password); request.open("PUT", SERVER + collection_href, true, user, encodeURIComponent(password));
request.onreadystatechange = function() { request.onreadystatechange = function() {
if (request.readyState !== 4) { if (request.readyState !== 4) {
return; return;
@ -288,7 +288,7 @@ function upload_collection(user, password, collection_href, file, callback) {
*/ */
function delete_collection(user, password, collection, callback) { function delete_collection(user, password, collection, callback) {
let request = new XMLHttpRequest(); let request = new XMLHttpRequest();
request.open("DELETE", SERVER + collection.href, true, user, password); request.open("DELETE", SERVER + collection.href, true, user, encodeURIComponent(password));
request.onreadystatechange = function() { request.onreadystatechange = function() {
if (request.readyState !== 4) { if (request.readyState !== 4) {
return; return;
@ -313,7 +313,7 @@ function delete_collection(user, password, collection, callback) {
*/ */
function create_edit_collection(user, password, collection, create, callback) { function create_edit_collection(user, password, collection, create, callback) {
let request = new XMLHttpRequest(); let request = new XMLHttpRequest();
request.open(create ? "MKCOL" : "PROPPATCH", SERVER + collection.href, true, user, password); request.open(create ? "MKCOL" : "PROPPATCH", SERVER + collection.href, true, user, encodeURIComponent(password));
request.onreadystatechange = function() { request.onreadystatechange = function() {
if (request.readyState !== 4) { if (request.readyState !== 4) {
return; return;