Skip to content
This repository has been archived by the owner on Jul 27, 2024. It is now read-only.

Commit

Permalink
Escapar els putos caracters peque el puto google drive sino es pensa que
Browse files Browse the repository at this point in the history
el fitxer no hi es
  • Loading branch information
bcedu committed Oct 9, 2019
1 parent b10367f commit 13309f5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/VGriveClient.vala
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ namespace App {
private void check_deleted_files () {
// Mira els fitxers que hi ha a la llibreria
// Si no existeixen en local o en remot, el treu de la llibreria i l'elimina de on encara hi sigui
// TODO: mirar data de modificacio per saber si eliminarlo o no
if (!this.is_syncing ()) return;
var it = this.library.map_iterator ();
bool exist_local, exist_remote, must_delete = false;
Expand Down Expand Up @@ -1026,6 +1025,12 @@ namespace App {
string new_path = path.substring(0, path.length-current_file.length-1);
string parent_id = this.get_file_id(new_path);
if (parent_id == "") parent_id = "root";

// Escapem caracters especials del nom del fitxer
current_file = current_file.replace("\\", "\\\\"); // contrabarra
current_file = current_file.replace("#", "\\#"); // hashtag
current_file = current_file.replace("'", "\\'"); // cometa simple

string q = "trashed = False and name = '%s' and '%s' in parents".printf(current_file, parent_id);
DriveFile[] res = this.search_files(q);
if (res.length != 1) return "";
Expand Down

0 comments on commit 13309f5

Please sign in to comment.