<commit_before>  /////////
 // DAV //
/////////

var DAV = function() {
	var dav = {}
	var keyToUrl = function(userAddress, key, wallet) {
		var userAddressParts = userAddress.split("@");
		var resource = document.domain;
		var url = wallet.davBaseUrl
			+"webdav/"+userAddressParts[1]
			+"/"+userAddressParts[0]
			+"/"+resource
			+"/"+key;
		return url;
	}
	dav.get = function(userAddress, key, cb) {
		var wallet = getWallet();
		var xhr = new XMLHttpRequest();
		xhr.open("GET", keyToUrl(userAddress, key, wallet), true);
		xhr.onreadystatechange = function() {
			if(xhr.readyState == 4) {
				if(xhr.status == 200) {
					cb(xhr.responseText);
				} else if(xhr.status == 404) {
					cb(null);
				} else {
					alert("error: got status "+xhr.status+" when doing basic auth GET on url "+keyToUrl(key, wallet));
				}
			}
		}
		xhr.send();
	}
	
	dav.put = function(key, text, cb) {
		var wallet = getWallet();
		var xhr = new XMLHttpRequest();
		
		//xhr.open("PUT", keyToUrl(key, wallet), true, wallet.userAddress, wallet.davToken);
		//HACK:
		xhr.open("PUT", keyToUrl(key, wallet), true);
		xhr.setRequestHeader("Authorization", "Basic "+Base64.encode(wallet.userAddress +':'+ wallet.davToken));
		//END HACK.

		xhr.onreadystatechange = function() {
			if(xhr.readyState == 4) {
				if(xhr.status != 200 && xhr.status != 201 && xhr.status != 204) {
					alert("error: got status "+xhr.status+" when doing basic auth PUT on url "+keyToUrl(key, wallet));
				} else {
					cb();
				}
			}<commit_msg>fix merge problem<commit_after>  /////////
 // DAV //
/////////

var DAV = function() {
	var dav = {}
	var keyToUrl = function(userAddress, key, wallet) {
		var userAddressParts = userAddress.split("@");
		var resource = document.domain;
		var url = wallet.davBaseUrl
			+"webdav/"+userAddressParts[1]
			+"/"+userAddressParts[0]
			+"/"+resource
			+"/"+key;
		return url;
	}
	dav.get = function(userAddress, key, cb) {
		var wallet = getWallet();
		var xhr = new XMLHttpRequest();
		xhr.open("GET", keyToUrl(userAddress, key, wallet), true);
		xhr.onreadystatechange = function() {
			if(xhr.readyState == 4) {
				if(xhr.status == 200) {
					cb(xhr.responseText);
				} else if(xhr.status == 404) {
					cb(null);
				} else {
					alert("error: got status "+xhr.status+" when doing basic auth GET on url "+keyToUrl(userAddress, key, wallet));
				}
			}
		}
		xhr.send();
	}
	
	dav.put = function(key, text, cb) {
		var wallet = getWallet();
		var xhr = new XMLHttpRequest();
		
		//xhr.open("PUT", keyToUrl(wallet.userAddress, key, wallet), true, wallet.userAddress, wallet.davToken);
		//HACK:
		xhr.open("PUT", keyToUrl(wallet.userAddress, key, wallet), true);
		xhr.setRequestHeader("Authorization", "Basic "+Base64.encode(wallet.userAddress +':'+ wallet.davToken));
		//END HACK.

		xhr.onreadystatechange = function() {
			if(xhr.readyState == 4) {
				if(xhr.status != 200 && xhr.status != 201 && xhr.status != 204) {
					alert("error: got status "+xhr.status+" when doing basic auth PUT on url "+keyToUrl(key, wallet));
				} else {
					cb();
				}
			}
{'fraction_non_alphanumeric': 0.18285157518674894, 'fraction_numerical': 0.013640792465086067, 'mean_word_length': 3.219178082191781, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4143044', 'n_tokens_mistral': 1298, 'n_tokens_neox': 1086, 'n_words': 249}