Skip to content

Commit e56d3c0

Browse files
Merge branch 'release/0.5.0' into develop
# Conflicts: # pom.xml
2 parents 14c667b + f9cce87 commit e56d3c0

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

pom.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020

2121
<properties>
2222
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
23+
<maven.compiler.target>1.8</maven.compiler.target>
24+
<maven.compiler.source>1.8</maven.compiler.source>
2325
</properties>
2426

2527
<licenses>

src/main/java/org/fugerit/java/github/issue/export/GithubIssueExport.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
import java.net.PasswordAuthentication;
1111
import java.net.Proxy;
1212
import java.net.URL;
13-
import java.net.URLEncoder;
13+
import java.nio.charset.StandardCharsets;
1414
import java.util.ArrayList;
15+
import java.util.Base64;
1516
import java.util.Iterator;
1617
import java.util.List;
1718
import java.util.Locale;
@@ -237,9 +238,6 @@ private static String readUrlData( String url, GithubIssueInfo info ) throws Exc
237238
String githubUser = info.getProperty( ARG_GITHUB_USER );
238239
String githubPass = info.getProperty( ARG_GITHUB_PASS );
239240
logger.info( "connecting to url : "+url+" (user:"+githubUser+")" );
240-
if ( StringUtils.isNotEmpty( githubUser ) && StringUtils.isNotEmpty( githubPass ) ) {
241-
url = url.replace( "api.github.com" , githubUser+":"+URLEncoder.encode( githubPass, "UTF-8" )+"@api.github.com" );
242-
}
243241
HttpURLConnection conn;
244242
if ( !StringUtils.isEmpty( proxyHost ) && !StringUtils.isEmpty( proxyPort ) ) {
245243
logger.debug( "using proxy : "+proxyHost+":"+proxyPort+" (user:"+proxyUser+")" );
@@ -257,6 +255,11 @@ public PasswordAuthentication getPasswordAuthentication() {
257255
} else {
258256
URL u = new URL( url );
259257
conn = (HttpURLConnection)u.openConnection();
258+
if ( StringUtils.isNotEmpty( githubUser ) && StringUtils.isNotEmpty( githubPass ) ) {
259+
String encoded = Base64.getEncoder().encodeToString((githubUser+":"+githubPass).getBytes(StandardCharsets.UTF_8));
260+
logger.info( "Set authentication : "+encoded );
261+
conn.setRequestProperty("Authorization", "Basic "+encoded);
262+
}
260263
}
261264
StringBuffer buffer = new StringBuffer();
262265
if ( conn.getResponseCode() != 200 ) {

0 commit comments

Comments
 (0)