mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-29 17:02:05 +13:00
fixed #6956: Update Dropbox direct link format
This commit is contained in:
parent
11c10b31a2
commit
5852944ee7
3 changed files with 3 additions and 51 deletions
|
@ -59,14 +59,6 @@ public override GenericUploader CreateUploader(UploadersConfig config, TaskRefer
|
|||
public override TabPage GetUploadersConfigTabPage(UploadersConfigForm form) => form.tpDropbox;
|
||||
}
|
||||
|
||||
// TEMP: For backward compatibility
|
||||
public enum DropboxURLType
|
||||
{
|
||||
Default,
|
||||
Shortened,
|
||||
Direct
|
||||
}
|
||||
|
||||
public sealed class Dropbox : FileUploader, IOAuth2Basic
|
||||
{
|
||||
private const string APIVersion = "2";
|
||||
|
@ -91,8 +83,7 @@ public sealed class Dropbox : FileUploader, IOAuth2Basic
|
|||
private const string URLDelete = URLAPI + "/files/delete";
|
||||
private const string URLMove = URLAPI + "/files/move";
|
||||
|
||||
private const string URLShareDirect = "https://dl.dropboxusercontent.com/s";
|
||||
private const string URLPublicDirect = "https://dl.dropboxusercontent.com/u";
|
||||
private const string URLShareDirect = "https://dl.dropboxusercontent.com/scl/fi/";
|
||||
|
||||
public OAuth2Info AuthInfo { get; set; }
|
||||
public string UploadPath { get; set; }
|
||||
|
@ -444,18 +435,12 @@ public DropboxMetadata Move(string fromPath, string toPath)
|
|||
|
||||
private static string GetDirectShareableURL(string url)
|
||||
{
|
||||
string find = "dropbox.com/s/";
|
||||
string find = "dropbox.com/scl/fi/";
|
||||
int index = url.IndexOf(find);
|
||||
|
||||
if (index > -1)
|
||||
{
|
||||
string path = url.Substring(index + find.Length);
|
||||
index = path.LastIndexOf('?');
|
||||
|
||||
if (index > -1)
|
||||
{
|
||||
path = path.Remove(index);
|
||||
}
|
||||
string path = url.Remove(0, index + find.Length);
|
||||
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
{
|
||||
|
|
|
@ -160,9 +160,6 @@ public class UploadersConfig : SettingsBase<UploadersConfig>
|
|||
public bool DropboxAutoCreateShareableLink { get; set; } = true;
|
||||
public bool DropboxUseDirectLink { get; set; } = false;
|
||||
|
||||
// TEMP: For backward compatibility
|
||||
public DropboxURLType DropboxURLType = DropboxURLType.Default;
|
||||
|
||||
#endregion Dropbox
|
||||
|
||||
#region FTP
|
||||
|
|
|
@ -28,7 +28,6 @@ You should have received a copy of the GNU General Public License
|
|||
using ShareX.Properties;
|
||||
using ShareX.ScreenCaptureLib;
|
||||
using ShareX.UploadersLib;
|
||||
using ShareX.UploadersLib.FileUploaders;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
@ -272,35 +271,6 @@ private static void MigrateHistoryFile()
|
|||
|
||||
private static void UploadersConfigBackwardCompatibilityTasks()
|
||||
{
|
||||
if (UploadersConfig.IsUpgradeFrom("11.6.0"))
|
||||
{
|
||||
if (UploadersConfig.DropboxURLType == DropboxURLType.Direct)
|
||||
{
|
||||
UploadersConfig.DropboxUseDirectLink = true;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(UploadersConfig.AmazonS3Settings.Endpoint))
|
||||
{
|
||||
bool endpointFound = false;
|
||||
|
||||
foreach (AmazonS3Endpoint endpoint in AmazonS3.Endpoints)
|
||||
{
|
||||
if (endpoint.Region != null && endpoint.Region.Equals(UploadersConfig.AmazonS3Settings.Endpoint, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
UploadersConfig.AmazonS3Settings.Endpoint = endpoint.Endpoint;
|
||||
UploadersConfig.AmazonS3Settings.Region = endpoint.Region;
|
||||
endpointFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!endpointFound)
|
||||
{
|
||||
UploadersConfig.AmazonS3Settings.Endpoint = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (UploadersConfig.CustomUploadersList != null)
|
||||
{
|
||||
foreach (CustomUploaderItem cui in UploadersConfig.CustomUploadersList)
|
||||
|
|
Loading…
Reference in a new issue