Skip to content

Commit 4f23cf8

Browse files
committed
Fix: no login on download
1 parent 7e0321b commit 4f23cf8

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

server/src/main/java/org/diskproject/server/repository/WingsAdapter.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ private boolean login() {
315315
// Check for Session ID to make sure we've logged in
316316
for (Cookie cookie : context.getCookieStore().getCookies()) {
317317
if (cookie.getName().equalsIgnoreCase("JSESSIONID")) {
318+
System.out.println("JSESSIONID: " + cookie.getValue());
318319
return true;
319320
}
320321
}
@@ -670,8 +671,10 @@ public byte[] fetchDataFromWings(String dataid) {
670671
formdata.add(new BasicNameValuePair("data_id", dataid));
671672
url += "?" + URLEncodedUtils.format(formdata, "UTF-8");
672673

673-
this.login();
674-
CloseableHttpClient client = HttpClientBuilder.create().build();
674+
if (!this.login()) {
675+
return null;
676+
}
677+
CloseableHttpClient client = HttpClientBuilder.create().setDefaultCookieStore(this.cookieStore).build();
675678
byte[] bytes = null;
676679
try {
677680
HttpGet securedResource = new HttpGet(url);
@@ -860,7 +863,7 @@ public String addRemoteDataToWings(String url, String name, String dType) throws
860863
/* FIXME: Wings rename does not rename the file, only the id
861864
* thus we cannot upload two files with the same name and then rename them. */
862865
// Get the file.
863-
CloseableHttpClient client = HttpClientBuilder.create().build();
866+
CloseableHttpClient client = HttpClientBuilder.create().setDefaultCookieStore(this.cookieStore).build();
864867
byte[] bytes = null;
865868
try {
866869
HttpGet securedResource = new HttpGet(url);

0 commit comments

Comments
 (0)