Skip to content

Commit

Permalink
1.1.2
Browse files Browse the repository at this point in the history
corrections
  • Loading branch information
lucasromeiro committed Jun 5, 2018
1 parent c0ce2c8 commit fa652ed
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=DropboxManager
version=1.1.1
version=1.1.2
author=ANTÔNIO CEZAR DE CASTRO LIMA, CRISTIANO HORA DE OLIVEIRA FONTES, LUCAS DE ARAÚJO WANDERLEY ROMEIRO
maintainer=Lucas Romeiro <[email protected]>
sentence=Manipulate your Dropbox files by ESP8266
Expand Down
17 changes: 14 additions & 3 deletions src/DropboxManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ PARA EXPLICAÇÕES EM PORTUGUES, CONSULTAR O ARQUIVO “README.md” QUE SE ENCO
#include "FS.h"
#include "DropboxManager.h"

#define ver "v1.1.1"
#define ver "v1.1.2"
//#define debug_mode Serial


Expand Down Expand Up @@ -488,20 +488,24 @@ bool DropboxMan::fileDownload(String localFile, String address, bool type){
//"Content-Length: 0\r\n\r\n"
);


#ifdef debug_mode
debug_mode.println("Request sent!");
#endif
uint32_t millisTimeoutClient;
millisTimeoutClient = millis();
String line;
bool ok;
uint32_t contentData;
ok=0;
while (client.connected() && ((millis()-millisTimeoutClient)<timeout_client)) {
line = client.readStringUntil('\n');
if (line == "\r") {
break;
}
if(line.indexOf("original-content-length: ")!=-1){
contentData=line.substring(line.indexOf("original-content-length: ")+25).toInt();//lenght data
}
if(line.indexOf("\", \"path_display\": \""+address+"\", \"")!=-1){
ok=1;
}
Expand Down Expand Up @@ -533,7 +537,14 @@ bool DropboxMan::fileDownload(String localFile, String address, bool type){
ESP.wdtFeed();

client.readBytes(_buffer,1000);
_buffer[1000]='\0';
if(contentData>=1000){
_buffer[1000]='\0';
contentData=contentData-1000;
}else{
_buffer[contentData]='\0';
contentData=0;
}

files.print(_buffer);
}
}
Expand Down

0 comments on commit fa652ed

Please sign in to comment.