Sharing a folder with a name of a folder that is already shared gives 500 error

Bug #640179 reported by Lucio Torre
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bindwood
Invalid
Medium
John O'Brien
Ubuntu One Servers
Fix Released
Medium
John O'Brien

Bug Description

@login_required()
@require_POST
def claim_share_offer(request, shareofferid):
    """Claim a share offer and redirect to it"""
    user = request.user
    try:
        share_offer = claim_shareoffer(user.id, user.username, u"",
                                       str(shareofferid))
    except ShareAlreadyAccepted:
        storage_user = get_storage_user(request.user.id)
        share_offer = storage_user.get_share(str(shareofferid))
    share_path = u"#f=s/%s from %s" % (
        share_offer.name, share_offer.shared_by.visible_name)
    return HttpResponseRedirect(reverse("files.index", args=[share_path]))

(it guesses the path to the share)

Revision history for this message
Lucio Torre (lucio.torre) wrote :

Lets try again:
i shared a folder named "casa" with someone. They accepted it. Everything works.
I created another folder named "casa" somewhere else and shared it to the same someone. They got the email and clicked on the claim link. When claiming the share they got a 500 error.
<!-- OOPS-ID-1720appserverZBFacbJCAcAHaEDdJJHfBfEAcaEJJcGaf29485 -->

Revision history for this message
Lucio Torre (lucio.torre) wrote :

The method claim_shareoffer has no options for assigning the folder name.
Also, the doc says:
    """Claim a shared folder offer sent to an email.

    Used when a user has been offered a shared folder, but has not
    subscribed yet and they are not a storageuser. This will create a
    storageuser in an inactive state so they will have the share once they
    subscribe.
    """
which contradicts the docs of SystemGateway.claim_shareoffer:
 """Claim a share offer sent to an email.

        This is a strange function in that the user may not have subscribed yet
        and may not have a storage user record.
        """
        # A anonymous share offer is a share sent to an email address but not
        # to a specific user. We also don't let user's claim their own share
(i do have a storage user, so the docstring surely looks wrong)

The name should be altered so it wont conflict with the previous share.

Changed in bindwood:
assignee: nobody → John O'Brien (jdobrien)
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
Lucio Torre (lucio.torre) wrote :
Download full text (7.2 KiB)

oops data here:

Oops-Id: 1720appserverZBFacbJCAcAHaEDdJJHfBfEAcaEJJcGaf29485
Exception-Type: IntegrityError
Exception-Value: duplicate key value violates unique constraint "share_shared_to_key"
Date: 2010-09-16T04:26:10.479708+00:00
Branch: ubunet-rev-3160
Revision: 3160
Last-Update: 2010-09-07 15:16:56 +0100
URL: /files/shareoffer/0eb1b1d3-eaed-40cf-8f56-95422383c551/claim/
HTTP-Status: 500
Duration: 0.424609899521

HTTP_REFERER=https://one.ubuntu.com/files/shareoffer/0eb1b1d3-eaed-40cf-8f56-95422383c551/
request-end=1284611170.48
SCRIPT_NAME=
REQUEST_METHOD=POST
PATH_INFO=/files/shareoffer/0eb1b1d3-eaed-40cf-8f56-95422383c551/claim/
HTTP_ORIGIN=https://one.ubuntu.com
SERVER_PROTOCOL=HTTP/1.1
QUERY_STRING=
CONTENT_LENGTH=52
HTTP_ACCEPT_CHARSET=ISO-8859-1,utf-8;q=0.7,*;q=0.3
HTTP_USER_AGENT=Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Ubuntu/10.10 Chromium/6.0.472.53 Chrome/6.0.472.53 Safari/534.3
HTTP_CONNECTION=Keep-Alive
HTTP_COOKIE=__utmz=78170954.1284578682.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); currency=USD; sessionid=7905fdee806223836c5d71d9056e0690; __utma=78170954.794566597.1284611138.1284611138.1284611138.1; __utmc=78170954; __utmb=78170954.1.10.1284611138
SERVER_NAME=one.ubuntu.com
REMOTE_ADDR=190.190.97.66
wsgi.url_scheme=https
HTTP_VIA=1.1 one.ubuntu.com
SERVER_PORT=9003
HTTP_HOST=one.ubuntu.com
HTTP_CACHE_CONTROL=max-age=0
HTTP_ACCEPT=application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
http-code=500
HTTP_ACCEPT_LANGUAGE=en-US,en;q=0.8
request-start=1284611170.05
CONTENT_TYPE=application/x-www-form-urlencoded
HTTP_ACCEPT_ENCODING=gzip,deflate,sdch

0000-0025 SELECT auth_user.date_joined, auth_user.last_login, auth_user.email, auth_user.first_name, auth_user.id, auth_user.is_active, auth_user.is_staff, auth_user.is_superuser, auth_user.last_name, auth_user.password, auth_user.username FROM auth_user WHERE auth_user.id = %s LIMIT 1
0025-0106 SELECT Share.accepted, Share.access, Share.email, Share.id, Share.name, Share.shared_by, Share.shared_to, Share.status, Share.subtree, Share.when_last_changed, Share.when_shared, StorageUser.id, StorageUser.root_volume_id, StorageUser.shard_id, StorageUser.status, StorageUser.subscription_status, StorageUser.username, StorageUser.visible_name FROM Share, StorageUser WHERE Share.shared_by = StorageUser.id AND Share.id = %s AND Share.status = %s
0106-0116 SELECT StorageUser.id, StorageUser.root_volume_id, StorageUser.shard_id, StorageUser.status, StorageUser.subscription_status, StorageUser.username, StorageUser.visible_name FROM StorageUser WHERE StorageUser.id = %s LIMIT 1
0116-0127 SELECT Share.accepted, Share.access, Share.email, Share.id, Share.name, Share.shared_by, Share.shared_to, Share.status, Share.subtree, Share.when_last_changed, Share.when_shared FROM Share WHERE Share.shared_by = %s AND Share.shared_to = %s AND Share.status = %s AND Share.subtree = %s
0127-0146 UPDATE Share SET accepted=%s, shared_to=%s WHERE Share.id = %s

Traceback (most recent call last):
  Module /srv/ubuntuone.com/production/ubunet-rev-3160/utilities/../lib/storm/database.py, line 366, in _check_disconnect
    return function...

Read more...

Changed in bindwood:
status: Triaged → Invalid
Changed in ubuntuone-servers:
status: New → Triaged
importance: Undecided → Medium
assignee: nobody → John O'Brien (jdobrien)
John O'Brien (jdobrien)
Changed in ubuntuone-servers:
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.