Latest Rclone's link command produces less helpful OneDrive link than 1.55.1

What is the problem you are having with rclone?

When using Onedrive as the remote, running "rclone link" on the Rclone version (1.56.1) produces a URL at https://api.onedrive.com/v1.0/shares/ whereas an older version (1.55.1) generates a share link at https://1drv.ms/u/s

What is your rclone version (output from rclone version)

rclone v1.56.1

  • os/version: unknown
  • os/kernel: 4.4.18-g8bcbd8a-dirty (aarch64)
  • os/type: linux
  • os/arch: arm64
  • go/version: go1.16.8
  • go/linking: static
  • go/tags: none

Which OS you are using and how many bits (eg Windows 7, 64 bit)

Linux ARM and AMD 64-bit

Which cloud storage system are you using? (eg Google Drive)

OneDrive

The command you were trying to run (eg rclone copy /tmp remote:tmp)

rclone link onedrive-remote:Test/image.jpg

The rclone config contents with secrets removed.

[onedrive-remote]
type = onedrive
token = {"access_token":"XXXX","expiry":"XXXX"}
drive_id = XXXX
drive_type = personal

A log from the command with the -vv flag

2021/09/21 21:49:25 DEBUG : rclone: Version "v1.56.1" starting with parameters ["./rclone2" "link" "onedrive-remote:Test/image.jpg" "-vv"]
2021/09/21 21:49:25 DEBUG : Creating backend with remote "onedrive-remote:Test/image.jpg"
2021/09/21 21:49:25 DEBUG : Using config file from "/mnt/md0/public/backup_util/rclone.conf"
2021/09/21 21:49:29 DEBUG : fs cache: adding new entry for parent of "onedrive-remote:Test/image.jpg", "onedrive-remote:Test"
https://api.onedrive.com/v1.0/shares/u!XXXX
2021/09/21 21:49:29 DEBUG : 3 go routines active

A log from the command using Rclone version 1.55.1

2021/09/21 21:52:29 DEBUG : Using config file from "/mnt/md0/public/backup_util/rclone.conf"
2021/09/21 21:52:29 DEBUG : rclone: Version "v1.55.1" starting with parameters ["./rclone" "link" "onedrive-remote:Test/image.jpg" "-vv"]
2021/09/21 21:52:29 DEBUG : Creating backend with remote "onedrive-remote:Test/image.jpg"
2021/09/21 21:52:34 DEBUG : fs cache: adding new entry for parent of "onedrive-remote:Test/image.jpg", "onedrive-remote:Test"
https://1drv.ms/u/s!XXXX
2021/09/21 21:52:35 DEBUG : 3 go routines active

The real issue

Both of these URLs are valid and link to the correct file, however the URL at the domain of api.onedrive.com is a direct link to download the file, whereas the URL at 1drv.ms links to a preview of the file. Is this new type of link intended behavior for this version of Rclone?

For my specific use case, the old URL format that links to the OneDrive preview is more useful. If this new behavior is intentional, is there a configuration I can change to revert back to 1drv.ms?

It was intentional:

rclone link should provide a link to the file directly (so usable with curl) if at all possible. It isn't always possible so it returns a web interface link otherwise.

No, currently not. But it could be, I think. Perhaps you can make a feature request om github, and it might be picked up?

1 Like

In case anybody else ever needs to get a 1drv.ms link instead of api.onedrive.com, here is what I learned from reading the thread linked by @albertony:

Given a URL at api.onedrive.com, identify the base64 encoded string and decode it

For example, the base64 string of api.onedrive.com/v1.0/shares/u!aHR0cHM6Ly8xZHJ2Lm1zL3cvcyFBcW1GaUk3bWFYclJnVDdQR2NLXzdKeVpsQmNv/root/content
is aHR0cHM6Ly8xZHJ2Lm1zL3cvcyFBcW1GaUk3bWFYclJnVDdQR2NLXzdKeVpsQmNv. Decoded this becomes https://1drv.ms/w/s!AqmFiI7maXrRgT7PGcK_7JyZlBco which can be used to link to OneDrive's preview page.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.