mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-11-24 08:37:17 +01:00
Apply URL encode/decode changes
This commit is contained in:
parent
10e7a5cf9c
commit
c7848e5e86
@ -185,10 +185,8 @@ public class ReCaptchaActivity extends AppCompatActivity {
|
|||||||
final int abuseEnd = url.indexOf("+path");
|
final int abuseEnd = url.indexOf("+path");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String abuseCookie = url.substring(abuseStart + 13, abuseEnd);
|
handleCookies(Utils.decodeUrlUtf8(url.substring(abuseStart + 13, abuseEnd)));
|
||||||
abuseCookie = Utils.decodeUrlUtf8(abuseCookie);
|
} catch (final StringIndexOutOfBoundsException e) {
|
||||||
handleCookies(abuseCookie);
|
|
||||||
} catch (IllegalArgumentException | StringIndexOutOfBoundsException e) {
|
|
||||||
if (MainActivity.DEBUG) {
|
if (MainActivity.DEBUG) {
|
||||||
Log.e(TAG, "handleCookiesFromUrl: invalid google abuse starting at "
|
Log.e(TAG, "handleCookiesFromUrl: invalid google abuse starting at "
|
||||||
+ abuseStart + " and ending at " + abuseEnd + " for url " + url, e);
|
+ abuseStart + " and ending at " + abuseEnd + " for url " + url, e);
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package org.schabi.newpipe.settings;
|
package org.schabi.newpipe.settings;
|
||||||
|
|
||||||
import static org.schabi.newpipe.extractor.utils.Utils.decodeUrlUtf8;
|
|
||||||
import static org.schabi.newpipe.util.Localization.assureCorrectAppLanguage;
|
import static org.schabi.newpipe.util.Localization.assureCorrectAppLanguage;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
@ -30,7 +29,6 @@ import org.schabi.newpipe.util.FilePickerActivityHelper;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URI;
|
|
||||||
|
|
||||||
public class DownloadSettingsFragment extends BasePreferenceFragment {
|
public class DownloadSettingsFragment extends BasePreferenceFragment {
|
||||||
public static final boolean IGNORE_RELEASE_ON_OLD_PATH = true;
|
public static final boolean IGNORE_RELEASE_ON_OLD_PATH = true;
|
||||||
@ -107,28 +105,15 @@ public class DownloadSettingsFragment extends BasePreferenceFragment {
|
|||||||
|
|
||||||
private void showPathInSummary(final String prefKey, @StringRes final int defaultString,
|
private void showPathInSummary(final String prefKey, @StringRes final int defaultString,
|
||||||
final Preference target) {
|
final Preference target) {
|
||||||
String rawUri = defaultPreferences.getString(prefKey, null);
|
final Uri uri = Uri.parse(defaultPreferences.getString(prefKey, ""));
|
||||||
if (rawUri == null || rawUri.isEmpty()) {
|
if (uri.equals(Uri.EMPTY)) {
|
||||||
target.setSummary(getString(defaultString));
|
target.setSummary(getString(defaultString));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rawUri.charAt(0) == File.separatorChar) {
|
final String summary = ContentResolver.SCHEME_FILE.equals(uri.getScheme())
|
||||||
target.setSummary(rawUri);
|
? uri.getPath() : uri.toString();
|
||||||
return;
|
target.setSummary(summary);
|
||||||
}
|
|
||||||
if (rawUri.startsWith(ContentResolver.SCHEME_FILE)) {
|
|
||||||
target.setSummary(new File(URI.create(rawUri)).getPath());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
rawUri = decodeUrlUtf8(rawUri);
|
|
||||||
} catch (final IllegalArgumentException e) {
|
|
||||||
// nothing to do
|
|
||||||
}
|
|
||||||
|
|
||||||
target.setSummary(rawUri);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isFileUri(final String path) {
|
private boolean isFileUri(final String path) {
|
||||||
|
Loading…
Reference in New Issue
Block a user