cancel
Showing results for 
Search instead for 
Did you mean: 

Link to content or Discussions, possible bug?

guito4you
Champ in-the-making
Champ in-the-making
When a link is removed, the file to which it points, remains unaffected (it seems ok).
Conversely, if you remove the original file, the link become orphans and take the next behaivor:

1. The browser show the next message in red: "A system error happened during the operation: NodeRef must be supplied for creation of a Node".

2. Due this error , the browser doesn't show the rest of spaces and content within the same directory where the link was located.

3. I don't know how to recovery this situation. Impossible remove the "orphan" link and the space (where the "orphan" link are located)  keep unable (impossible to add new content and news spaces)

Note: Links to "Discussions" has the same behaivor (avobe explained)

it could be a possible bug?

Another question:

There are any way to view into the file details if a file has some links?

Thanks in advance
11 REPLIES 11

kevinr
Star Contributor
Star Contributor
It is a bug and was fixed in 2.1E

Thanks,

Kevin

guito4you
Champ in-the-making
Champ in-the-making
I think I've Alfresco Enterprise 2.1 as you can see in my alfresco.log file:

Alfresco started (Enterprise Network): Current version 2.1.0 (112) schema 73 - Installed version 2.1.0 (112) schema 73

Thanks

kevinr
Star Contributor
Star Contributor
OK. The bug that was fixed was that if the destination of space/file link was removed, it was impossible to browse in the space containing the link. Does that work for you? The error you mention:
"A system error happened during the operation: NodeRef must be supplied for creation of a Node".
What exactly are your steps to get the error?

Thanks,

Kevin

guito4you
Champ in-the-making
Champ in-the-making
Steps to get the error:

1. Upload a new file (for instance, testfile.pdf) into your home space.

2. Create a new space (for instance (Test Folder) into your home space in order tu put the future link.

3. Copy the file testfile.pdf in your clipboard and then create a link into the Test Folder.

4. Delete testfile.pdf (original file, not destination!!)

After that, you can see the error: "A system error happened during the operation: NodeRef must be supplied for creation of a Node" into the "Test Folder".

If you try to upload new content o create new space into "test Folder" the browser doesnt' show anything, only show the above error.

Anyway, you can acces to the new content  by search or by navigator (left frame)

If you have another spaces into "Test Folder" created before "broken link", it's possible acces by navigation left frame, but impossible to see into the "main frame"

Note: Links to "Discussions" and links to Folders has the same behaivor (avobe explained)

Conversely, if you remove the destination link, everything works fine.

Thanks

kevinr
Star Contributor
Star Contributor
I have tested and confirmed. Yes the bug is present Smiley Sad The issue that was fixed for 2.1E has indeed been fixed - however it looks like a different change in 2.1E has caused a very similar bug to occur.

I have raised JIRA item for it and will look at it ASAP:
http://issues.alfresco.com/browse/AWC-1605

Thanks,

Kevin

kevinr
Star Contributor
Star Contributor
Fixed: http://issues.alfresco.com/browse/AWC-1605

Index: BrowseBean.java
===================================================================
— BrowseBean.java     (revision 6874)
+++ BrowseBean.java     (working copy)
@@ -780,7 +780,7 @@
                   node = new MapNode(nodeRef, this.nodeService, fileInfo.getProperties());
                   // only display the user has the permissions to navigate to the target of the link
                   NodeRef destRef = (NodeRef)node.getProperties().get(ContentModel.PROP_LINK_DESTINATION);
-                  if (new Node(destRef).hasPermission(PermissionService.READ) == true)
+                  if (destRef != null && new Node(destRef).hasPermission(PermissionService.READ) == true)
                   {
                      node.addPropertyResolver("url", this.resolverLinkUrl);
                      node.addPropertyResolver("webdavUrl", this.resolverLinkWebdavUrl);
@@ -799,7 +799,7 @@
                   node = new MapNode(nodeRef, this.nodeService, fileInfo.getProperties());
                   // only display the user has the permissions to navigate to the target of the link
                   NodeRef destRef = (NodeRef)node.getProperties().get(ContentModel.PROP_LINK_DESTINATION);
-                  if (new Node(destRef).hasPermission(PermissionService.READ) == true)
+                  if (destRef != null && new Node(destRef).hasPermission(PermissionService.READ) == true)
                   {
                      node.addPropertyResolver("icon", this.resolverSpaceIcon);
                      node.addPropertyResolver("smallIcon", this.resolverSmallIcon);

Thanks,

Kevin

olex
Champ in-the-making
Champ in-the-making
Steps to get the error:
1. Upload a new file (for instance, testfile.pdf) into your home space.
2. Create a new space (for instance (Test Folder) into your home space in order tu put the future link.
3. Copy the file testfile.pdf in your clipboard and then create a link into the Test Folder.
4. Delete testfile.pdf (original file, not destination!!)
After that, you can see the error: "A system error happened during the operation: NodeRef must be supplied for creation of a Node" into the "Test Folder".
This seems fixed - there is no error.

But destination link (with PROP_LINK_DESTINATION = null)
still exists into "Test Folder": it's visible using "webdav" style URL for instance
or via custom space traverse code.

olex
Champ in-the-making
Champ in-the-making
Steps to get the error:
1. Upload a new file (for instance, testfile.pdf) into your home space.
2. Create a new space (for instance (Test Folder) into your home space in order tu put the future link.
3. Copy the file testfile.pdf in your clipboard and then create a link into the Test Folder.
4. Delete testfile.pdf (original file, not destination!!)
After that, you can see the error: "A system error happened during the operation: NodeRef must be supplied for creation of a Node" into the "Test Folder".
This seems fixed - there is no error.

But destination link (with PROP_LINK_DESTINATION = null)
still exists into "Test Folder": it's visible using "webdav" style URL for instance
or via custom space traverse code.

BTW, there is one more issue with links via WebDAV: if you click on TYPE_FILELINK item in browser
(using URL like http://localhost:8080/alfresco/webdav/Test/Link%20to%20test.wav.url),
org.alfresco.repo.webdav.GetMethod returns
"The node's content is missing" error instead of content data.

I think "executeImpl" method should provide something like this:
            ContentReader reader = null;
           
            if (nodeInfo.isLink())
            {
              reader = fileFolderService.getReader(nodeInfo.getLinkNodeRef());
            }
            else
            {
              reader = fileFolderService.getReader(nodeInfo.getNodeRef());
            }
Also I think it's quite useful to show original content length for "links" (not 0 as now) in UI.

Thanks

Hi olex, I need some help about create link using rest  api, 

I m using Alfresco Community 5.2. I want to create link a file(this file is in another site) to site by using REST API. But I can not find any document about this issue.

I m clicking "copy to" on myfiles folder or any site folder. And after that, it is appear a button called "create link". By clicking this button, I can create link for this document to any place. But now, I want to make this process (create link) with rest api.