[android] Fixed get params encoding - bookmarks catalog

This commit is contained in:
Dmitry Donskoy 2018-07-12 21:15:52 +03:00 committed by Vlad Mihaylenko
parent d414978221
commit af93ed38de

View file

@ -8,11 +8,16 @@ import android.text.TextUtils;
import android.util.Pair;
import com.mapswithme.maps.bookmarks.data.BookmarkManager;
import com.mapswithme.util.log.Logger;
import com.mapswithme.util.log.LoggerFactory;
import java.net.URLEncoder;
public class BookmarksDownloadManager
{
private static final String QUERY_PARAM_ID_KEY = "id";
private static final String QUERY_PARAM_NAME_KEY = "name";
private static final Logger LOGGER = LoggerFactory.INSTANCE.getLogger(LoggerFactory.Type.MISC);
@NonNull
private final Context mContext;
@ -40,11 +45,12 @@ public class BookmarksDownloadManager
Uri dstUri = uriPair.second;
String title = makeTitle(srcUri);
LOGGER.d("Bookmarks catalog url", "Value = " + dstUri);
DownloadManager.Request request = new DownloadManager
.Request(dstUri)
.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE)
.setTitle(title)
.setDestinationInExternalFilesDir(mContext,null, dstUri.getLastPathSegment());
.setDestinationInExternalFilesDir(mContext, null, dstUri.getLastPathSegment());
return downloadManager.enqueue(request);
}
@ -68,7 +74,8 @@ public class BookmarksDownloadManager
for (String each : srcUri.getQueryParameterNames())
{
builder.appendQueryParameter(each, srcUri.getQueryParameter(each));
String queryParameter = srcUri.getQueryParameter(each);
builder.appendQueryParameter(each, URLEncoder.encode(queryParameter));
}
Uri dstUri = builder.build();
return new Pair<>(srcUri, dstUri);